After being "counted out and written off" Dalton McGuinty's Liberals managed to secure a third straight mandate on Thursday, but fell just shy of a third straight majority.

With all the votes counted, the Liberals had won 53 ridings, one short of the 54 needed for a majority.

With all polls reporting, the Liberals had captured 37.6 per cent of the popular vote, with the Progressive Conservatives close behind at 35.4 per cent. NDP support was at 22.7 per cent, with the Greens at 2.9 per cent, down just over five percentage points from their showing in the 2007 election.

The PC and NDP gains came entirely at the expense of the Liberals, the only party not to pick up seats from the other two parties. The Progressive Conservative Party under Tim Hudak was poised to add 12 seats to the 25 they held when parliament dissolved while the NDP added seven seats to the 10 they held heading into the election.

Leaders of all three major parties were re-elected in their ridings: McGuinty (Ottawa South), Hudak (Niagara-West Glanbrook) and the NDP's Andrea Horwath (Hamilton Centre).

In his victory speech at the Chateau Laurier hotel in Ottawa, McGuinty said the result will allow Ontario to move forward with "an experienced Liberal government."

"It's time to move forward the Ontario way, it's about building and working together," he said. "It's not about giving in to defeatism or negativity. It's about building a bright future with ideas, enthusiam and hope. We didn't listen to the naysayers, we listened to Ontarians."

"Liberalism in this great country is alive and well and living in Ontario."

In conceding defeat, however, Hudak said the results show that voters were not entirely happy with McGuinty.

"My friends, it is very clear the people of Ontario have put Dalton McGuinty on a very short leash," he said.

Horwath also said Thursday's results show Ontarians were keen for change.

"The people have said very clearly we need to move in a direction where people are at the top of the agenda," she said. "Our team of New Democrats will work with all MPPs to make Ontario's government work."

In the weeks before the writ dropped, some polls had the Liberals badly trailing Hudak's PCs. Although the Liberals managed a third win under McGuinty, they will have to form government with 19 fewer seats than they held in the last sitting of the legislature.

Many of the Liberal losses came in southwestern Ontario, where their seat count was reduced from 10 to four. The PCs, meanwhile, went from two to six seats in the region, while the NDP picked up two seats there.

The Liberals also sustained losses in northern Ontario. They entered the election holding seven of the region's 11 seats, but were reduced to four seats on Thursday. The NDP increased its seat total in northern Ontario from three to five.

Toronto was tipped as a key battleground in the election, with the Liberals entering the race holding 18 of the city's 22 seats. For the most part, the Liberals were able to hold their ground in so-called "fortress Toronto," losing only one seat downtown, where NDP upstart Jonah Schein defeated Cristina Martins.

In other key Toronto races:

Kathleen Wynne, a minister in McGuinty’s cabinet, survived a challenge from Andrea Mandel-Campbell, a former anchor on CTV’s Business News Network.

Liberal Mike Colle was able to retain his seat in Eglinton-Lawrence, fighting off a challenge from Rocco Rossi, a former mayoralty candidate and high-profile PC candidate.

Liberal Cortney Pasternak, a television journalist, failed to unseat the NDP's Cheri DiNovo in Parkdale-High Park.

Longtime NDP MPP Rosario Marchese survived a close challenge from Liberal Sarah Thomson in Trinity Spadina.

In the area outside of Toronto, the so-called 905 region, the Liberals were also able to hold their ground for the most part. In Brampton-Springdale, Linda Jeffrey held off a challenge from PC candidate Pam Hundal.

In Bramalea-Gore-Malton, Liberal Kuldip Kular lost to young lawyer Jagmeet Singh of the NDP.

Other high-profile Liberals re-elected Thursday included Dwight Duncan (Windsor-Tecumseh), Brad Duguid (Scarborough Centre) and Chris Bentley (London West).

Liberal cabinet minister Leona Dombrowsky went down to defeat in Prince Edward-Hastings, losing to PC candidate and local radio personality Todd Smith. Liberal minister Sophia Aggelonitis lost her seat in Hamilton Mountain.

The Green Party had a poor showing, with its popular vote falling from eight per cent to just under three per cent. The Greens also failed to win a single seat, as party leader Mike Schreiner finished fourth in Simcoe-Grey.

Voter turnout was a record low 49.2 per cent. The previous record was set in the last election in 2007, when it was 52.8 per cent.

Mobile friendly liveblog