In a large shallow pan with high sides heat the olive oil over medium heat. Once the oil is hot, it will shimmer, add the diced onion and garlic to the pan and gently cook for about 5 minutes until the onions are soft and translucent and the garlic is fragrant.
Pour in the tinned tomatoes and vegetable stock and taste and adjust the seasoning. Add the spaghetti to the pan, ensuring the noodles are submerged in the stock, and simmer for about 12-15 minutes uncovered until the pasta is cooked and the liquid has thickened to a sauce. If the pasta starts to look dry, add some hot water to the pan in 200ml increments.
Stir the pasta and sauce a few times during the cooking process so that the pasta doesn’t stick to the bottom of the pan and the noodles don’t stick to each other. Continue to cook the pasta until it is al dente.
Remove the pan from the heat and stir in the mascarpone and spinach. Cover the pan with a tight-fitting lid and let the spinach wilt into the sauce for 5-7 minutes. Remove the lid and stir the pasta, add the lemon juice, adjust the seasoning, and divide between bowls. Top with shredded parmesan and serve.