I once watched an auto dealer paint an engine with the nozzle and valve from a WD-40 can attached to a paint can, the long spray tube allowed him to get into the nooks and crannies, I thought it was a pretty good idea but have never done it myself. He used a piece of thin cardboard as a shield for components he didn't want painted, worked pretty well. Steam cleaning the engine will at least allow the paint to stick and get the major crud off.
“She may not look like much, but she's got it where it counts, kid. I've made a lot of special modifications myself.”
— Han Solo