Bring a large pot of salted water to a boil. Add the spaghetti and cook until tender but still firm to the bite, stirring occasionally, about 8 minutes Drain, reserving 1 cup of the cooking liquid.
Meanwhile, heat 2 tablespoons of oil in a heavy large skillet over medium heat. Add the onions and saute until tender and beginning to brown, about 15 minutes adding salt and pepper, to taste. Stir in the marjoram, and saute until fragrant, about 1 minute. Add the cooked pasta and the remaining 2 tablespoons of oil and toss with enough reserved cooking liquid, 1/4 cup at a time, to moisten. Toss with the feta cheese. Season the pasta with salt and pepper, to taste. Transfer to bowls and serve.