Preheat the oven to 200°C (180°C fan) and lightly grease a baking tray.
Cook the lentils in boiling water for 20–25 minutes until tender. Drain thoroughly and leave to dry for 5 minutes.
Heat olive oil in a frying pan over medium heat. Cook the onions for about 10 minutes until softened. Add the garlic and cook for another 2 minutes.
Transfer half of the onion mixture to a food processor and reserve the remaining half in the pan for the sauce.
Place the spinach in a colander and pour boiling water over it to wilt. Allow it to cool slightly, then squeeze out as much moisture as possible.
Add the cooked lentils, spinach, pesto, and lemon zest to the food processor. Blend until combined but still slightly textured.
Pulse in the pine nuts. Transfer the mixture to a bowl and stir in the egg and breadcrumbs. Season generously with salt and pepper.
Shape the mixture into approximately 20 balls and arrange them on the prepared baking tray.
Bake for 15–20 minutes until golden brown and firm.
While the balls bake, prepare the sauce. Add chopped tomatoes, tomato purée, vinegar, sugar, water, basil leaves, salt, and pepper to the pan with the reserved onions.
Simmer for 15–18 minutes until slightly thickened.
Cook the spaghetti according to package directions.
Add the Italian Veggie Balls to the sauce and gently stir to coat.
Serve over spaghetti and garnish with fresh basil leaves.