A new survey in the Virginia governor’s race gave former congressman Tom Perriello his first edge in public polling in the Democratic primary since he launched a surprising challenge to Lt. Gov. Ralph Northam in January.

Perriello has a narrow lead among Democratic-leaning voters, with 25 percent to Northam’s 20 percent, according to a Quinnipiac University poll released Tuesday. His edge is tenuous, falling within the range of sampling error and with more than half of voters still undecided.

Perriello and Northam each drew 19 percent of voters in the organization’s last poll in February.

The poll also found that former political strategist Ed Gillespie had a clear edge in the three-person GOP primary field with 28 percent of Republican-leaning voters. Corey A. Stewart, chairman of the Prince William Board of County Supervisors, drew 12 percent of respondents, while state Sen. Frank W. Wagner (Virginia Beach) took 7 percent.

[Can Perriello win over southwest Virginia voters in Trump country?]

Republican candidates for governor Ed Gillespie, standing, Corey Stewart, to his right, and Sen. Frank Wagner. Denver Riggleman, left, dropped out. (Erica Yoon/The Roanoke Times via AP)

Because Virginia has no party registration, voters can cast ballots in either major party’s June 13 primary.

In hypothetical general election matchups, the poll found that either Democratic candidate would easily beat a Republican by double digits.

But the edge in voter preferences is probably smaller because the sample leaned Democratic and included registered voters instead of likely voters. The electorates in what are usually lower-turnout, off-year races are typically more favorable to Republicans.

A March poll from the Wason Center for Public Policy at Christopher Newport University found Gillespie in a dead heat with Democrats in a general election.

Other poll findings from Tuesday suggested favorable terrain for Democrats in the general election.

President Trump is unpopular in Virginia, with 36 percent approving of his performance and 57 percent disapproving.

And just over half of voters approved of Gov. Terry McAuliffe (D), who is constitutionally barred from serving consecutive terms. About four in 10 voters disapproved of the Republican-controlled state legislature. Those findings are almost unchanged from February.

McAuliffe and nearly every state and federal Democratic officeholder in Virginia is endorsing Northam for governor, but Perriello has gained steam since jumping into the race.

[Northam has deep support across Virginia in bid for governor]

“Lt. Gov. Ralph Northam originally had been expected to coast to the nomination, but former congressman Tom Perriello is inching ahead,” said Peter A. Brown, assistant director of the Quinnipiac University poll.

The survey found that Perriello has a 15-point lead among very liberal voters, who are more likely to show up for a primary. He has a similar lead among men and is tied with Northam among women.

Polling was conducted after Perriello gained his most high-profile endorsement yet — from Sen. Bernie Sanders (I-Vt.), the former presidential candidate.

Perriello and Northam were each seen favorably by 24 percent of respondents, while about two-thirds of voters had no opinion of either Democrat.

Gillespie, who nearly unseated Sen. Mark R. Warner (D-Va.) in 2014, was the best known of any candidate. More than half had an opinion, and those who disapproved slightly outnumbered those who approved.

[At Confederate ball, Virginia gubernatorial candidate dons Scottish gear]

More than three-quarters of respondents were not familiar with Stewart or Wagner.

The poll found that Sen. Tim Kaine (D-Va.) remains popular in Virginia five months after his losing bid for vice president on Hillary Clinton’s ticket.

No Republicans have announced plans to challenge him next year, but Carly Fiorina, the former GOP presidential candidate, and conservative radio host Laura Ingraham have said they are considering it. In hypothetical matchups, Kaine would defeat Fiorina by 24 points and Ingraham by 21 points.

The first-term senator raised $2.9 million in the first quarter of the year.

Kaine has 58 percent-to-34 percent job approval and a 57- to-36 percent favorability rating. Fiorina has a 26-to-36 percent favorability rating, and 37 percent don’t know enough about her to form an opinion.

Warner, who has enjoyed a high profile lately as the ranking Democrat on the Senate Intelligence Committee, has a 62-to-27 percent approval rating.

Pollsters surveyed 1,115 Virginians between Friday and Wednesday, with a margin of error of 2.9 percentage points. The margin of error is about 4.6 percentage points in the primary polling.

Jenna Portnoy and Scott Clement contributed to this report.