It's a simple dish but it's easy to get it wrong. Here's how to do it right.
In a tall stockpot, bring 3 quarts of water and 2 tablespoons salt to a boil.
If using pear tomatoes, wash and stem. If using vine-ripened tomatoes, score bottoms with a small "X"; blanch 5 seconds in boiling water. Plunge tomatoes into an ice-water bath, then remove the skins. Using a chef's knife, cut flesh from cores, and cut into 1/4-inch-thick strips; place in a sieve set over a bowl. Press the cores of tomatoes through sieve; discard seeds. If using canned tomatoes, strain, and pass through a food mill.
Drop spaghetti into boiling water; stir. Cook until al dente, about 11 minutes.
Place a 12-inch saute pan over medium heat; add oil. Add garlic to pan. Cook, stirring occasionally, until garlic is lightly golden, about 30 seconds. Add red-pepper flakes and remaining 1/4 teaspoon salt. Cook until garlic is medium golden, about 1 minute.
Increase heat to high. Tilting pan at an angle, add the tomatoes. Cook, swirling pan occasionally, until tomatoes begin to break down, pear tomatoes begin to burst, or canned tomatoes begin to thicken, 5 to 6 minutes. If using pear tomatoes, mash a few with a spoon. If pear tomatoes start to get too dry, add a little water from the stockpot.
Drain pasta in a colander, reserving 1 cup liquid in case sauce gets too dry. Add pasta to sauce in saute pan; cook until sauce begins to cling to pasta, 3 to 4 minutes. Stir in basil; cook 30 seconds more. Divide among bowls, and sprinkle with cheese, if desired.