United got back in the game with a freak goal in the 82nd minute and almost snatched a point in a grandstand finish.
Rovers opened brightly with skipper Shane Sherriff seeing a fourth minute shot deflected on to a post.
Rotherham rarely threatened in the opening period with clear chances but had the majority of the ball before Rovers opened the scoring. Ritchie Partridge got in their best shot but it was a yard wide.
Greenacre headed on to the top netting for Tranmere before they doubled their lead in the 43rd minute. Gareth Taylor placed a header into the corner from a pinpoint cross by Paul McLaren.
Greenacre almost got a third for Tranmere early in the second half when his close-range shot was blocked on the line by Scott Wiseman.
Rotherham gradually worked up a head of steam and it needed an excellent save by loan keeper Joe Hart to deny Will Hoskins in the 56th minute.
Hart had only been signed earlier in the day from Manchester City for a 28-day term.
But Hart was the hero in the 90th minute with a superb fingertip save after a clearance by Ian Goodison cannoned goalwards off Martin Woods.
Sherriff was excellent for the winners and Greenacre was always lively up front. Woods starred in midfield for the Millers but they came alive far too late in proceedings to really make a fist of it, and slip to third bottom in the table, three points off safety.