Justin Trudeau, the young leader of Canada's Liberals and the son of a popular former prime minister, has surged to a stunning election victory, bringing a dramatic end to Stephen Harper's nine-year government.

Key points: Justin Trudeau's Liberal Party wins enough seats to form majority government

Justin Trudeau's Liberal Party wins enough seats to form majority government Trudeau expected to be elected 23rd prime minister of Canada

Trudeau expected to be elected 23rd prime minister of Canada Stephen Harper to resign as leader of the Conservative Party

Stephen Harper to resign as leader of the Conservative Party Trudeau has pledged to run budget deficits to stimulate growth in Canada

As soon as results arrived from central Canada, broadcasters were prepared to declare Mr Trudeau was set to be the 23rd prime minister of Canada.

Further counting firmed up the victory, with Mr Trudeau and the Liberal Party set to govern as a majority government having won 184 out of the 338 seats in the House of Commons — a dramatic recovery from the 2011 election when the Liberal Party won just 34 seats.

"My friends, we beat fear with hope. We beat cynicism with hard work," Mr Trudeau told a crowd of cheering supporters in Montreal.

"We beat negative, divisive politics with a positive vision that brings Canadians together."

Mr Harper's Conservative Party won only 99 seats this time around, a significant drop from the 166 seats it swept up in 2011.

Conservative Party president John Walsh said Mr Harper would resign as party leader.

"I have spoken to prime minister Stephen Harper and he has instructed me to reach out to the newly elected parliamentary caucus to appoint an interim leader," Mr Walsh said in a statement.

Mr Trudeau, 43, is the son of charismatic former leader Pierre Trudeau, who governed Canada from 1968 to 1979 and again from 1980 to 1984.

His victory comes the day after his late father would have turned 95.

Breakdown: Seats won out of 338 Liberal: 184 (54%)

Liberal: 184 (54%) Conservative: 99 (29%)

Conservative: 99 (29%) NDP: 44 (13%)

NDP: 44 (13%) BQ: 10 (3%)

BQ: 10 (3%) Green: 1 (0%)

For the first time since his father's last victory in 1980, Mr Trudeau led the Liberal Party to a majority of seats in the French-speaking province of Quebec, breaking the separatist hold on the province.

The Liberals swept urban Ontario and gained seats in all provinces in western Canada where the party has struggled in recent decades.

"When the time for change strikes, it's lethal," former Conservative prime minister Brian Mulroney said in a television interview.

"I ran and was successful because I wasn't Pierre Trudeau. Justin is successful because he isn't Stephen Harper."

Mr Trudeau has said he will repair Canada's cool relations with US president Barack Obama's administration, withdraw Canada from the combat mission against Islamic State militants in favour of humanitarian aid, and tackle climate change.

He has pledged to run small budget deficits and spend on infrastructure to stimulate economic growth, which has been anaemic for years, raise taxes on high-income Canadians and reduce them for the middle class.

He also pledged to legalise marijuana.

Result marks end of an era for conservatives

Supporters of Liberal Party leader Justin Trudeau cheer at his election night headquarters in Montreal, Quebec. ( Reuters: Chris Wattie )

The result has been a disaster for the New Democratic Party, which swept Quebec and finished ahead of the Liberals across Canada at the 2011 election.

Political pundits have already began to speculate on the makeup of a Trudeau government while pondering what caused the downfall of Mr Harper, 56, who has been criticised for his aloof personality but won credit for economic management in a decade of global fiscal uncertainty.

Mr Harper had banked on a long 11-week campaign to wear down his political opponents.

The Conservative campaign to label Mr Trudeau as "just not ready" built up low expectations for Mr Trudeau, expectations he easily exceeded in televised debates and in day-to-day campaigning.

Canada's outgoing prime minister Stephen Harper was a close political friend of Tony Abbott. ( Reuters: Patrick Doyle )

For Mr Harper, it is the end of a political career in which he has rebuilt the conservative side of Canadian politics.

Elected the first leader of the newly merged Conservative Party in 2003, Mr Harper established the party at its first contest in 2004, led it to minority governments in 2006 and 2008, before achieving majority government in 2011.

A close political friend of former Australian prime minister Tony Abbott, Mr Harper's defeat comes just weeks after Mr Abbot was replaced as prime minister by Malcolm Turnbull.

Mr Harper always faced a difficult task of winning re-election.

Canada's resource-based economy had struggled with China's economic slow down, and Alberta's oil industry suffered from a collapsing oil price.

Having announced an extended election campaign designed to maximise pressure on his political opponents, Mr Harper's economic management claims were damaged when Canada was declared to be in recession during the campaign.

Meanwhile, Mr Trudeau has enjoyed a honeymoon period after being elected Liberal leader in 2013.

ABC/Reuters