The successor to Jim Flaherty has been chosen in the riding of Whitby-Oshawa, where voters on Monday night picked Conservative Pat Perkins to take his place in the House of Commons.

Whitby-Oshawa was one of two federal ridings to hold byelections on Monday night, with Conservatives winning both races, despite Justin Trudeau's Liberals making considerable gains to their share of the vote.

In Whitby, Perkins thanked Flaherty's family for their support and acknowledged the legacy that will continue with her victory.

Pat Perkins celebrates her byelection victory on Monday night with Christine Elliott, Ontario MPP and widow of former federal finance minister Jim Flaherty, at the Conservative headquarters in Whitby, Ont. (Nathan Denette/Canadian Press)

"The residents have now spoken and the Whitby-Oshawa riding will now remain blue," she said Monday night, shortly after CBC News projected that she would be elected as the next MP in the riding east of Toronto.

Monday's byelection saw Perkins win a close race over Liberal candidate Celina Caesar-Chavannes.

With 280 of 280 polls reporting on the Elections Canada website, Perkins had received 17,033 votes, putting her ahead of Caesar-Chavannes who received 14,082 votes at that point. The four other candidates in the race — including NDP candidate Trish McAuliffe, who placed second in Whitby-Oshawa in the 2011 federal election — didn't break single digits in terms of the percentage of support at the polls on Monday night.

Celina Caesar-Chavannes finished a close second to Pat Perkins in the federal byelection held in the Ontario riding of Whitby-Oshawa on Monday. (CBC)

Federal Liberal Leader Justin Trudeau was in the riding on Monday evening.

"Well that was quite the race," he said. "Remember when this campaign started? Nobody gave Liberals a chance, did they? Nobody thought we could do anything in Whitby-Oshawa. It was simply assumed that we would get nowhere. Well, I'll tell you what: nobody will make that assumption again — anywhere."

Caesar-Chavannes sounded a similar note as she thanked her supporters, shortly after Trudeau spoke.

"We overcame obstacles, we silenced the naysayers and we painted the town red," she said.

Mayoral experience

Perkins served as the mayor of Whitby for eight years. She withdrew as a candidate for re-election so that she could pursue a bid to be the next MP in Whitby-Oshawa.

She becomes the successor to the Flaherty, the Conservative MP who held the riding for eight years until his death earlier this year.

The late MP's surviving wife, Christine Elliott, said she was pleased with Perkins's victory at the polls.

"It is bittersweet, of course, because Jim held the riding here in provincial and then federal capacity since 1995, so it's been a long time and everybody here got used to doing things in a certain way," she told CBC News on Monday night.

"But we know that we have to move on now and I’m really proud that Pat has chosen to run and I think that she will carry on the tradition very well and we’re really going to be proud to have her represent us."

Perkins acknowledged that she and the voters will be returning to the polls soon, as the next federal election lies around the corner.

"I hope to see you all back in that one as well," said Perkins.

The polls in Whitby-Oshawa closed at 9:30 p.m. ET.

Whitby-Oshawa byelection results -- Nov. 17, 2014 Candidate Party % Josh Borenstein Independent 0.3 Celina Caesar-Chavannes Liberal 40.7 Craig Cameron Green 1.4 Trish McAuliffe NDP 8.1 Pat Perkins Conservative 49.2 John (The Engineer) Turmel Independent 0.3 Polls reporting 280/280

Turnout during the last federal election in Whitby-Oshawa was 63.2 per cent. The initial data posted to the Elections Canada website suggested that turnout at the byelection on Monday was about half that amount.

Easy Alberta win for Tories

In the other federal byelection in the Alberta riding of Yellowhead on Monday, CBC News projected a win for Conservative candidate Jim Eglinski, a retired RCMP officer and former mayor of Fort St. John, B.C., who now lives on an acreage outside Edson.

Voter turnout in that byelection could hit a historic low, with CBC estimating that fewer than one in five eligible voters made the trip to the polls.