Media playback is not supported on this device
Accies survived some nervous moments before Ash Taylor headed the Dons ahead after 34 minutes.
But the lead only lasted four minutes as Dougie Imrie scored from the penalty spot after Danny Redmond was challenged by goalkeeper Joe Lewis.
Rooney pounced when Gary Woods parried a James Maddison shot, before Accies' Scott McMann was shown a late red card.
The win - thanks to the Irish striker's 11th goal this season - takes Aberdeen to within four points of second-placed Rangers in the Scottish Premiership table.
Accies remain second bottom without a victory in 10 games since beating the Dons in October.
Aberdeen were fluid and dangerous from the off, exposing Accies' weakness on the left flank, with Louis Longridge inexperienced in a full-back role against Jonny Hayes.
Mark Reynolds netted early on, but referee Andrew Dallas saw pushing and ruled it out, perhaps a touch harshly as the Dons defender didn't appear to be the culprit.
It seemed only a matter of time for the home side, with visiting defenders struggling to cope with the recurring threat.
One corner in particular caused chaos involving a Reynolds header that was saved, an overhead kick clearance and a follow up effort from Andrew Considine with the ball eventually forced behind.
Chances and corners flowed. Perhaps one criticism that could be levelled at Aberdeen was how they had not managed to score before they did.
The breakthrough came from a set piece. Hayes floated a great free-kick to Taylor, whose header was equally accurate and found the corner.
Incredibly, Hamilton were almost immediately handed a route back into the match.
Taylor blundered to let Redmond in on Lewis, who appeared to hesitate, allowing the midfielder to nick the ball.
The goalkeeper got a touch on the ball, but it was not clear whether he had taken the man first. No matter, the referee gave the penalty, which Imrie fired home confidently.
Aberdeen responded well to that set-back, with Woods superbly tipping Taylor's drive over before Rooney appeared to be pushed in the box, but pleas were ignored.
The Dons went forward relentlessly. Manager Derek McInnes made a positive move, bringing on Maddison for Considine and it proved decisive.
It was Maddison's shot that Woods palmed back into play perfectly for the onrushing Rooney to net.
McMann prevented a third, hauling Hayes to the ground just outside the box that earned a red card with the winger in on goal.
No-one could realistically argue Aberdeen did not deserve the win. What is unclear is how they did not make it far more comfortable
It was a fourth successive defeat for Hamilton, albeit in a very tough run of fixtures. What will be more alarming for manager Martin Canning is the lack of wins in the last two months.
At times, the visitors were hanging on by a thread, struggling to contain the attacking threat they faced.
They had a fabulous chance for a second shortly before Rooney's goal and that would have made a huge difference.
Shay Logan gave possession away, Rakish Bingham surged clear and found Ali Crawford, but the midfielder could not get enough on his shot to beat Lewis while the goalkeeper was grounded. He should have scored.
Aberdeen manager Derek McInnes: "We passed up so many opportunities. It was one-way traffic in the first half.
"By and large I felt we were on the wrong end of a few decisions today and I thought we still managed to thoroughly deserve three points.
"Reynolds scores a perfectly valid goal. There was no infringement by Rooney. He was nowhere near the goalkeeper. For me it was a poor decision. We should be up and running with that goal.
"We had a penalty kick given against us that's not a penalty. Twice now we've played Hamilton, two poor penalty decisions against us. Thankfully today it didn't cost us."
Hamilton manager Martin Canning: "I think the game turns on a big moment. When you get your opportunities you've got to take them.
"We got the big opportunity with Ali Crawford to make it 2-1. It would have been exactly what we set out to do.
"We missed the opportunity and within five minutes they've scored to make it 2-1 to them. Had we taken our big opportunity it would be a different game."
Match ends, Aberdeen 2, Hamilton Academical 1.
Second Half ends, Aberdeen 2, Hamilton Academical 1.
Foul by Jonny Hayes (Aberdeen).
Michael Devlin (Hamilton Academical) wins a free kick in the attacking half.
Attempt saved. James Maddison (Aberdeen) right footed shot from outside the box is saved in the centre of the goal.
Scott McMann (Hamilton Academical) is shown the red card.
Jonny Hayes (Aberdeen) wins a free kick in the attacking half.
Foul by Scott McMann (Hamilton Academical).
James Maddison (Aberdeen) is shown the yellow card.
James Maddison (Aberdeen) wins a free kick on the right wing.
Foul by Dougie Imrie (Hamilton Academical).
Foul by Shaleum Logan (Aberdeen).
Daniel Redmond (Hamilton Academical) wins a free kick in the attacking half.
Ryan Jack (Aberdeen) wins a free kick in the attacking half.
Foul by Daniel Redmond (Hamilton Academical).
Michael Devlin (Hamilton Academical) is shown the yellow card.
Adam Rooney (Aberdeen) wins a free kick in the attacking half.
Foul by Michael Devlin (Hamilton Academical).
Attempt saved. Ali Crawford (Hamilton Academical) right footed shot from outside the box is saved in the centre of the goal.
Foul by Jonny Hayes (Aberdeen).
Georgios Sarris (Hamilton Academical) wins a free kick in the attacking half.
Attempt saved. Eamonn Brophy (Hamilton Academical) right footed shot from outside the box is saved in the centre of the goal.
Substitution, Aberdeen. Anthony O'Connor replaces Niall McGinn.
Hand ball by Grant Gillespie (Hamilton Academical).
Substitution, Hamilton Academical. Massimo Donati replaces Darian MacKinnon.
Attempt missed. Jonny Hayes (Aberdeen) left footed shot from the left side of the box is too high.
Attempt blocked. Daniel Redmond (Hamilton Academical) left footed shot from outside the box is blocked.
Attempt missed. Kenny McLean (Aberdeen) left footed shot from the centre of the box is too high.
Substitution, Hamilton Academical. Alejandro D'Acol replaces Rakish Bingham.
Attempt missed. Jonny Hayes (Aberdeen) left footed shot from the left side of the box misses to the right.
Substitution, Hamilton Academical. Eamonn Brophy replaces Louis Longridge.
Graeme Shinnie (Aberdeen) wins a free kick on the left wing.
Foul by Louis Longridge (Hamilton Academical).
Kenny McLean (Aberdeen) wins a free kick on the right wing.
Foul by Daniel Redmond (Hamilton Academical).
Attempt missed. James Maddison (Aberdeen) right footed shot from the left side of the box misses to the right.
Jonny Hayes (Aberdeen) wins a free kick on the left wing.
Foul by Michael Devlin (Hamilton Academical).
Goal!  Aberdeen 2, Hamilton Academical 1. Adam Rooney (Aberdeen) right footed shot from the centre of the box to the bottom left corner.
Attempt saved. James Maddison (Aberdeen) right footed shot from outside the box is saved in the centre of the goal.
Adam Rooney gave third-top Aberdeen a Scottish Premiership victory over stuffy Hamilton Accies.