Kentucky Democrats on Tuesday nominated the state’s attorney general, Andy Beshear, to run against embattled Gov. Matt Bevin, who fended off a surprisingly strong challenge in a Republican primary that illustrated his general election vulnerability.

[Kentucky June 2020 primary: What to watch for.]

Mr. Bevin captured only about 52 percent of the vote and lost a wide swath of counties in eastern Kentucky to Robert Goforth, a little-known state lawmaker.

In Mr. Beshear, the governor will be facing the son of the man he succeeded, in a race that will test whether Kentucky’s turn toward the G.O.P., and President Trump’s appeal in the state, is enough to offset the incumbent’s deep unpopularity. The general election is Nov. 5.

[Here’s our results page for the Kentucky governor primary.]

Mr. Beshear survived a scare of his own in Tuesday’s primary. He won with about 38 percent of the ballots after splitting voters with another mainstream Democrat, the former state auditor Adam Edelen, and a conservative Democrat, State Representative Rocky Adkins.