In a large pot or pan over medium heat, sauté the chopped onion in the olive oil for 5 minutes, stirring frequently.
Add garlic and ginger and cook 1 more minute, until fragrant.
Add the garam masala, turmeric and red pepper flakes to the pan and stir into the onion mixture. Add a few tablespoons of water if the mixture is too dry.
Add the dried lentils, canned tomatoes and their juices, coconut milk and vegetable broth to the pan. Stir well and turn the heat to med-high. Bring to a boil, then lower heat and simmer for about 20 minutes, until the lentils are cooked and soft. Stir frequently so the lentils don’t stick to the bottom and burn.
Squeeze the lemon juice into the pan, and stir in the spinach as well until wilted. Add salt to taste.