1. Place the beans in a colander and rinse well; transfer to a large Dutch oven and add two and a half quarts of water (remove any beans that float), two tablespoons of the oil, and the onion and garlic. Bring to a strong rolling boil, then reduce heat to keep the liquid at a very gentle simmer. Cook until the beans are thoroughly tender, two hours or longer. Add water as needed.
2. Drain the tomatoes and place them in a food processor or blender with the chilies; process to form a smooth puree.
3. Add the tomato puree to the beans along with one and a half teaspoons of salt. Partially cover and simmer, stirring frequently, for 15 minutes. Taste; season with additional salt if necessary.
4. In a medium-sized bowl, combine the masa mixture with the remaining tablespoon of oil, the baking powder, and one-half teaspoon of salt. Roll the dough into marble-size balls (about 30), pressing a dimple into each one with your fingertip.
5. Add two quarts of water to a large saucepan and bring to a boil; reduce the heat to a gentle simmer and season the water with about two teaspoons of salt. Add half of the masa dumplings and simmer gently until all have risen to the surface and are cooked through, about three minutes. (Remove one and test it by cutting it in half—it should be soft but not doughy.) Remove all of them with a slotted spoon, then repeat with the remaining dumplings.
6. Stir the spinach into the simmering beans mixture, then place the masa dumplings on top. Set the cover in place and remove the pot from the heat. Let stand five to 10 minutes, until everything is heated through.