Republican front-runner Donald Trump told supporters at Trump Tower in Manhattan that his campaign is "really, really rocking," after coming out ahead in New York's primary April 19. Rival Ted Cruz appeared to still be hopeful, telling Pennsylvania voters, "This is the year of the outsider. I'm an outsider." (Sarah Parnass/The Washington Post)

Republican front-runner Donald Trump told supporters at Trump Tower in Manhattan that his campaign is "really, really rocking," after coming out ahead in New York's primary April 19. Rival Ted Cruz appeared to still be hopeful, telling Pennsylvania voters, "This is the year of the outsider. I'm an outsider." (Sarah Parnass/The Washington Post)

Donald Trump is the projected winner of the New York Republican primary and Hillary Clinton is the projected winner of the Democratic primary, according to exit polls and early returns.

The Associated Press called the race for the party front-runners after polls closed at 9 p.m. ET, with Trump’s projected win called almost immediately, and Clinton’s at 9:45 p.m. The victories help Trump and Clinton solidify their leads at a time when both are beginning to talk more about the general election.

Trump’s victory puts him closer to clinching the GOP nomination and should at least temporarily quell speculation that he will fall short of the votes needed before the July convention.

Clinton held a comfortable lead throughout the campaign and her victory makes it near-mathematically impossible for Sen. Bernie Sanders (Vt.) to overtake her lead in the race for convention delegates.

“Today you proved once again, there’s no place like home,” Clinton told a raucous crowd of supporters gathered in Manhattan.

Nearby, at his Trump Tower, Trump greeted supporters in the lobby of his famed building flanked by his family.

“This has been an amazing week,” he said, noting that he is scheduled to campaign in Indiana, which votes next month, and will head to Pennsylvania in the coming days.

“We don’t have much of a race anymore based on what I’m seeing on television,” he added, gesturing to a nearby screen showing race results.

Polls had shown Clinton and Trump leading by double-digit margins in a state with a vastly diverse backdrop, stretching from the riches of Wall Street and suburban Westchester County to the struggles of industrial cities upstate like Watervliet and Watertown.

A big win for Trump brings him closer to securing an outright majority of Republican delegates — an outcome that remains in jeopardy and has prompted Sen. Ted Cruz (R-Tex.) to mount a spirited, methodical campaign to force a contested convention.

A Clinton victory provides momentum after a blitz of recent primary and caucus wins for Sanders. Unlike Trump, she is so far ahead in the delegate count that it would be nearly impossible for Sanders to catch her.

While the party front-runners spent much of the day in New York, Cruz and Ohio Gov. John Kasich on the GOP side and Sanders in the Democratic race stumped for votes in Maryland and Pennsylvania, which will hold primaries next week.

1 of 33 Full Screen Autoplay Close Skip Ad × What it looks like on the ground in New York for the primary election View Photos New York voters head to the polls for the Republican and Democratic presidential primaries. Caption New York voters headed to the polls Tuesday for the Republican and Democratic presidential primaries. April 19, 2016 After winning the New York primary, Hillary Clinton speaks to a packed room of supporters during the victory party at the Sheraton Hotel in midtown Manhattan. Melina Mara/The Washington Post Buy Photo Wait 1 second to continue.

[6 things to watch in New York’s primary tonight]

Early exit poll results in New York showed that Trump was poised for a commanding victory thanks to a less conservative electorate that favors an outsider in the White House.

A clear majority of New York Republican voters — seven in ten — said the party should nominate the leading candidate regardless of whether they achieve an absolute majority of convention delegates, according to exit poll results reported by CNN.

Trump has struggled among the most conservative Republicans this year, but in his home state he won more than six in ten of both “very” and “somewhat” conservative voters, far more than his competitors Kasich and Cruz, who won less than three in ten conservative supporters each. While moderate and liberal Republicans have typically been one of Trump’s best groups, he split this group with Kasich about evenly in early exit poll data with just over 40 percent support for each.

Most GOP primary voters also said they want the next president to hail from outside the political establishment. If that figure holds, it would mark the highest level of support for a political outsider in Republican contests this year.

Among Democrats, non-white primary voters made up a larger share of this year’s electorate, and Clinton led Sanders by 67 to 33 points among this group in preliminary exit polls reported by CNN, but her margin was slightly smaller than previous contests this year, where she’s led by an average of 41 points. Among white voters, Sanders led Clinton by just two percentage points in preliminary data.

New York’s primary allowed only registered Democrats and Republicans to participate in the contest, and the exit polls suggest that requirement played strongly to Clinton’s benefit. Fully 83 percent of Democratic primary voters said they typically consider themselves Democrats, 10 points higher than the average so far this year and trailing only Mississippi. Clinton won self-identified Democrats by a 61 to 39 percent margin. Sanders won nearly three-quarters of independents, but they accounted for only 14 percent of the electorate, similar to 12 percent in 2008.

Tuesday’s vote signaled stronger unity among Democrats than Republicans. At least six in ten New York Democratic primary voters said they would definitely support either Clinton or Sanders as the party’s nominee, according to preliminary exit poll data reported by ABC News. But about half of Republicans said they would “definitely support” Trump, while roughly a quarter would support Cruz, and three in ten would support Kasich.

[Trump’s field director steps aside]

Trump spent the evening at Trump Tower in Manhattan, where he lives and works. While several hundred reporters gathered in the pink marble lobby for his appearance, guests dressed in cocktail attire took the escalator downstairs to a party in the building’s food court.

Trump’s campaign manager, Corey Lewandowski, told reporters that his team is already looking ahead to the burst of nominating contests next week in Pennsylvania, Maryland, Delaware, Connecticut and Rhode Island.

“I think the Cruz campaign is going to be mathematically eliminated from the nomination a week from tonight,” Lewandowski said. “If the results go well tonight, he has to win 95 percent of the remaining delegates moving forward, which is almost an impossible task. I think it’s time to unite around Donald Trump, he’s the only person who can win the nomination, he’s the only person who can get the delegates, he’s the only one who can expand the map moving into the general election.”

When asked about the campaign’s sudden and dramatic restructuring, which has shifted power away from Lewandowski, the campaign manager replied: “We’re growing, baby.”

[Trump’s shift to more-seasoned staffers is a key inflection point for bid]

In New York City, the Board of Elections conceded that tens of thousands of Brooklyn voters had been purged from the voter rolls and residents complained about problems at polling sites across the city. Angered by the news, city officials announced plans to audit the agency and New York Mayor Bill be Blasio said he wanted the problems fixed in time for congressional primaries scheduled in June.

Despite the troubles, many New Yorkers celebrated their newfound relevance Tuesday, even if they have grown a bit weary of the barrage of ads on the airwaves in recent weeks.

“It’s nice. I feel like our vote usually doesn’t count,” said Sunita Ray, 41, who voted for Clinton in Midtown Manhattan. Still, she said she will not miss some aspects of the heated primary campaign. “The ads were a little annoying.”

[Clinton asks New Yorkers to make primary a referendum on Trump]

On Tuesday night, hundreds of upbeat Clinton supporters gathered in a Midtown Manhattan ballroom for her victory party. They danced to a live band and DJ as they waited for results to roll in. When news networks called the race for Clinton, the band played “Another One Bites the Dust” by the band Queen, and “Signed, Sealed, Delivered” by Stevie Wonder.

Aaron Leth, 30, has been a Clinton fan since he was a 6-year-old from Nebraska sending letters to the first lady in the White House.

“She’s gonna win. It’s her home territory, she knows it,” Leth said as he danced to the live band.

Throughout the campaign, Leth says he has seen Clinton become more relaxed and “rise to the occasion.”

“I feel like she’ stayed true to what she believes,” Leth said.

Leth said he thinks that the primary continues well into June for a reason, and that Sanders has every right to remain in the race: “The people are speaking.”

Clinton cast her own vote in Chappaqua in suburban New York, where supporters had waited outside with signs and buttons. She later flew to Washington to address the North America’s Building Trades Unions (NABTU) legislative conference before returning to New York City.

Sanders, who has been trailing throughout the contest, played down his prospects in New York, citing the state’s closed primary.

At a rally at Pennsylvania State University before the polls closed in New York, he told a crowd in a packed field house that he was going to do a lot better there than people thought, despite a number of obstacles.

“We’re going to do just fine tonight in New York,” Sanders told more than 6,600 people in State College, mostly college students, according to a figure supplied by the venue.

Angered by the closed primary, Sanders said New York officials need to “make some fundamental changes about how they do business.”

Sanders also said it was absurd that polls in upstate New York did not open until noon, a time that makes it impossible for some working-class voters to participate.

Like Sanders, Cruz braced for a loss in New York, polling behind not only Trump in recent surveys but also Kasich, whose only primary victory so far came in his home state. The loss came after a string of victories in Western states.

Campaigning in Philadelphia on Tuesday night, Cruz unveiled a new campaign stump speech, telling a crowd at the National Constitution Center that “this is the year of the outsider.”

“I am an outsider, Bernie Sanders is an outsider,” he added. “Both with the same diagnosis, but both with very different paths to healing. Millions of Americans have chosen one of these outsiders. Our campaigns don’t find our fuel in bundlers and special interests, but rather directly from the people.”

Cruz planned to meet Tuesday night with dozens of Republicans running to serve as national convention delegates at the Cleveland convention. On Wednesday, he is scheduled to campaign in Hershey, Pa.

Phillip and Johnson reported from New York and O’Keefe from Washington. John Wagner in State College, Pa., Sean Sullivan in Philadelphia, Jose A. Del Real in New York and Scott Clement, Juliet Eilperin and Anne Gearan in Washington contributed to this report.