Preheat the oven to 350 degrees F. Spray a muffin tin with cooking spray.
Line 4 of the muffin cups with a slice of ham.
Add the oil to a sauté pan and heat over medium-high heat. Add the mushrooms and cook for 3 minutes. Add the spinach and cook for another 3 minutes. Set the vegetables aside to cool.
In a medium bowl, whisk together the eggs, spinach and mushrooms, pepper, and cheese (optional).
Carefully fill the 4 muffin cups (lined with ham) with the egg mixture until 2/3 full (try to not let eggs drip on the sides underneath the ham slices).
Bake for 20-22 minutes, until the eggs are cooked through. Let cool for 5 minutes. Use a fork to go around the edges and loosen the ham and egg cups. Use a fork to scoop out each cup.