1. Heat olive oil in a pot over medium heat. Cook and stir onion and garlic in the hot oil until fragrant, 2 to 4 minutes. Cook and stir red pepper flakes, turmeric, and garam masala into onion mixture until coated, about 2 more minutes.
2. Stir lentils and broth into onion mixture; bring mixture to a boil, reduce heat to low, cover, and cook until lentils are softened but firm to the bite, about 15 minutes.
3. Stir sweet potatoes into lentil mixture; bring to a boil, reduce heat to low, cover, and simmer until sweet potatoes are tender and lentils are fully cooked, about 10 more minutes. Add spinach; cook until wilted, 3 to 5 minutes. Season with salt.