Heat the olive oil in a large frying pan over low heat. Add the onion and cook gently for 5 minutes, or until the onions are beginning to soften.
Turn up the heat to medium, add the sliced fennel, and sauté gently for an additional 6 to 8 minutes or until the fennel is tender and slightly caramelized. Add the spinach, garlic and red pepper flakes and continue to cook, stirring frequently, for another minute or two. Turn off the heat.
When the fennel is almost cooked, add the pasta to the pan of boiling water and cook until al dente.
Drain the pasta (reserving ½ cup of the starchy cooking water) thoroughly and toss with the onion, spinach and fennel mixture in the pan – adding pasta water if necessary. Add the lemon juice, season with salt and pepper, and serve immediately.