As Fianna Fail's leader, Ahern's strong personal popularity was cited by friend and foe alike as decisive in his victory.
Ahern said: "It's a great night for Fianna Fail, and it's a great night for the party machine."
Ireland's complex system of proportional representation, which encourages voters to rank candidates in order of preference, produced a gruelling two-day count.
Ballots had to be recounted multiple times so that lower-preference votes could be transferred from the ballots of victorious or eliminated candidates to those still in the race.
Fine Gael had hoped to rise to power in alliance with the Ireland's Labour Party, a combination that last governed Ireland between 1995 to 1997.
But while Fine Gael rebounded from its disastrous performance in the 2002 election, Labour failed to make gains, leaving them nowhere near the 83-seat total required to form a majority administration.
Analysts agreed that Labour was best positioned to help Fianna Fail, not Fine Gael, reach a majority.
But Labour leader Pat Rabbitte dedicated his campaign to ousting Fianna Fail from power.
Neither Ahern nor Rabbitte was willing to discuss the prospects of a Fianna Fail-Labour combination, a combination that was tried in 1992-94 and collapsed in acrimony.
Speaking before the final result, Ahern said his only goal was "to command a stable government for a five-year term".
He confirmed his intention to serve as prime minister until the middle of 2012.
Garret Fitzgerald, Ireland's former prime minister, said he expected Ahern to cut a deal with the Green Party.
Fitzgerald said: "Fianna Fail desperately needs the Greens at this stage. I don't see any other way to get a stable government."
Fianna Fail's coalition partner, the Progressive Democrats, whose tax-cutting, pro-business agenda influenced Ahern's policies, suffered electoral meltdown.
Michael McDowell, the party's leader and deputy prime minister, announced his immediate retirement from politics after he, his party deputy leader and party president all lost their seats.
The election's surprise losers were Sinn Fein, which had expected to capitalise on its success in Northern Ireland, where earlier this month it began running a power-sharing government.
Analysts had tipped the party to double its 2002 seat total to 10, but instead it lost ground.
Ahern is already the second-longest-serving prime minister in Irish history behind Eamon de Valera, the founder of Fianna Fail, who won seven elections from 1932 to 1957.