Bring a large pot of water to a boil. Cook spaghetti, stirring occasionally, until just tender, 9 to 11 minutes or according to package directions. Drain.

Meanwhile, heat oil in a large nonstick skillet over medium-high heat. Add garlic and cook, stirring, until fragrant, about 1 minute. Add anchovies (if using) and crushed red pepper and cook for 30 seconds more. Add tomatoes, reduce heat to medium and cook, stirring occasionally, for 8 minutes. Stir in tuna and cook until it is incorporated into the sauce and heated through, 2 minutes more. Divide the spaghetti evenly among 4 plates, top with sauce and garnish with basil. Serve hot.