Preheat the oven to 400 degrees F.
Trim the tops and stems off the beets. Was the beets under cool running water and scrub them with a brush. Wrap the beets in aluminum foil and bake for 45 minutes, or until tender. Let cool, then peel and coarsely chop the beets.
In a skillet large enough to hold all of the pasta, combine the olive oil, garlic, and red pepper. Cook over medium heat for about 30 seconds, or until the garlic is fragrant and the oil is sizzling. Add the chopped beets and turn them in the oil mixture until just heated through.
Bring a large pot of cold water to a boil Add salt and the spaghetti. Cook until the spaghetti is almost al dente, tender yet firm to the bite. Drain the spaghetti, reserving 1/2 cup of the cooking water.
Pour the spaghetti into the skillet with the beets. Add some of the cooking water. Simmer over medium heat, constantly turning the spaghetti with beets, until the pasta is evenly colored, about 2 minutes.