Kathleen Wynne has won the leadership of the Ontario Liberal Party and is set to become the province’s first female premier, after a closely fought race with Sandra Pupatello.

Wynne, the 59-year-old MPP for Don Valley West, is a long-time party member who has had several cabinet roles, including minister of transportation and minister of education.

She has vowed to bring back the legislature on Feb. 19, saying Ontarians are not looking for another election.

Wynne, who is openly gay, had earlier asked delegates in an opening speech: “Can a gay woman win?”

She now has an answer.

Throughout her leadership campaign, she vowed to represent all minorities and reinforce ties within her party. After being declared the winner Saturday evening, she brought caucus members on stage in a symbolic show of unity.

She also noted in her victory speech that, while she holds a Toronto riding, she will represent all of Ontario as premier.

“Can we get this Toronto thing out of the way? I am going to be the premier for the whole province,” she said.

Wynne will replace Dalton McGuinty as premier. McGuinty, who announced on Oct. 15 he would step down, has held the office since 2003.

The race went down to a third ballot, with Wynne winning 1,050 votes and her main rival, Sandra Pupatello, getting 866. Pupatello, 50, is the former MPP for Windsor West.

Pupatello had actually pulled ahead in the second ballot, beating Wynne by 67 votes. But moments later, Charles Sousa and Gerard Kennedy threw their support to Kathleen Wynne.

“She’s been a great champion for the community,” Sousa said of Wynne.

Harinder Takhar, however, backed Pupatello after finishing last on the second ballot.

“The creation of jobs is important to me,” said Takhar when asked why he chose to support Pupatello, explaining that she has strong focus on the economy.

The first to withdraw from the race was Eric Hoskins, who drew the fewest votes in the first ballot. The St. Paul’s MPP immediately threw his support behind Wynne, eliciting a thunderous cheer from the crowd.

Asked why he chose to support Wynne, Hoskins said she encompassed the qualities needed to lead the Liberal party and the province.

“Integrity, compassion, commitment, she’s a team player and all the qualities that we need,” he said, noting that his decision on who to support was not an easy one.

Going into Saturday’s convention, oddsmakers had correctly forecast that the province could have its first female premier designate by the end of the day with Pupatello and Wynne leading the race to replace McGuinty.

In a statement, Prime Minister Stephen Harper thanked McGuinty for “his service to Ontario” and congratulated Wynne.

“I look forward to working with Ms. Wynne on addressing issues that matter to Ontarians, and in particular the creation of jobs and economic growth,” he said.

Ontario Progressive Conservative Leader Tim Hudak also congratulated Wynne, but made it clear that she would have a tough time in the legislature.

“Ms. Wynne inherits, and must now confront, many urgent challenges in her new role,” he said in a statement. “Our province has lost precious time -- more than 14 months since the last election. The Legislature was shuttered by prorogation, and government ground to a halt as successors to the outgoing Premier focused exclusively on internal Liberal Party politics. The deep fiscal hole they have dug has grown deeper still, and the business of the people remains neglected.”