Image caption Park Geun-hye is seeking to become South Korea's first female leader

Millions of South Koreans have cast ballots in a presidential election seen as too close to call.

Park Geun-hye of the governing Saenuri party is looking to make history as South Korea's first female president.

But she faces a tough challenge from Moon Jae-in of the Democratic United Party, who has been steadily eroding her lead in the polls.

Whoever wins will replace President Lee Myung-bak, who is stepping down, as the law requires, after his five-year term.

Economic issues including welfare provision and job creation have dominated campaigning.

'New era'

Polls opened at 06:00 (21:00GMT) and closed 12 hours later. Three television stations were expected to release joint exit polls shortly after voting closed, with formal results expected early on Thursday.

Turn-out at 16:00 - with two hours of polling to go - was 65.2%, already past the final turn-out figure of 63% in the 2007 election, Yonhap news agency said.

Analysis The key to the result may lie in two distinct groups. Young voters in their 20s formed the backbone of support for a former presidential contender - software mogul Ahn Cheol-soo, who dropped out of the race last month. The question of who they'll vote for now - if they vote at all - is seen as crucial to the result. Some analysts also predict that a tranche of voters in their 40s could help decide the result, by swinging to one side or the other. Support for the two main candidates is divided strongly along generational lines, with support for Park Geun-hye strongest among voters in their 50s and 60s. Backing for Moon Jae-in comes mainly from those in their 30s and 40s. The presidential candidates

A national holiday has been declared so people can cast their ballots.

"Though it's cold today, I hope you will take part in the voting and open up a new era that every one of you has yearned for," Ms Park said after voting in Seoul.

Park Geun-hye is the daughter of former military ruler General Park Chung-hee, a polarising figure credited with transforming South Korea into an economic success story during his 1961-1979 rule, but accused of ruthlessly crushing dissent.

Both Ms Park's parents were assassinated - her mother in 1974 by a pro-North Korea gunman and her father in 1979 by his own spy chief.

Ms Park, 60, who in September apologised for human rights abuses during her father's era, said on Tuesday she would be "a president of the people's livelihoods, who thinks only about the people".

"I will restore the broken middle class and open an era in which the middle class make up 70% of the population," she said in a news conference at her party's headquarters in Seoul.

Mr Moon, a former human rights lawyer, was once jailed for protesting against General Park's regime.

Image caption Mr Moon says if people want change they need to cast their ballots

He was a chief of staff to Mr Lee's predecessor, Roh Moo-hyun, who killed himself in 2009 while under investigation for corruption.

In his news conference, Mr Moon pointed to the current corruption and incompetency allegations surrounding Ms Park's own party.

"This overall crisis... will not be resolved by replacing the representative player. We must change the entire team," the 59-year-old said.

Casting his ballot on Wednesday, he appealed for voters to turn out. "If you have been unsatisfied over the last five years, please change the world with your votes," he said.

For all their differences, the two candidates have put forward remarkably similar policies, the BBC's Lucy Williamson in Seoul says.

They have both promised to boost social welfare spending, close the gap between the rich and poor and rein in the country's family-run giant conglomerates, known as chaebol.

On the issue of North Korea, which has not featured heavily in the campaign despite its recent rocket launch, both candidates have promised more engagement with Pyongyang - though, in Ms Park's case, more cautiously than her rival.

Our correspondent says the electorate appears to be more engaged than usual, with one recent poll suggested more than 80% of voters are planning to cast their ballots

South Korea uses a first-past-the-post system, and so the candidate with the most votes will become president.