Louisiana has become the second GOP-dominated state this month in which a Democrat narrowly won a gubernatorial race against a candidate backed by President Donald Trump, signaling that the president’s ability to boost Republican candidates may have limits as 2020 approaches.

John Bel Edwards, a rare Democratic governor in the Deep South, received 51% of the votes Saturday, barely fending off a challenge from businessman Eddie Rispone, who aligned closely with the president. Earlier this month, Democrat Andy Beshear in Kentucky narrowly defeated incumbent Republican Gov. Matt Bevin. In both races, President Trump visited the states to campaign for his party’s candidates.

“Trump is a powerful campaigner, but we’re starting to see some limits to that: That his campaigning might extend only to himself, to his own interests,” said Brian Brox, a political-science professor at Tulane University in New Orleans.

In Louisiana, Mr. Edwards, 53, played down his party affiliation during the campaign, focusing instead on issues like his state’s improving economy and his expansion of Medicaid. He also highlighted his conservative positions on social issues, including his support for gun rights and opposition to abortion.

A total of about 1.5 million votes were cast Saturday in the runoff race, according to the Louisiana Secretary of State’s office. When Mr. Edwards was first elected in 2015, about 1.2 million people voted in the runoff.