In a column in his hometown newspaper in Janesville, Wis., Mr. Ryan said that recent conversations with Mr. Trump had convinced him that the billionaire developer will help advance the conservative agenda that the speaker is trying to introduce.
“Through these conversations, I feel confident he would help us turn the ideas in this agenda into laws to help improve people’s lives,” said Mr. Ryan, who is also chairman of the Republican National Convention that will nominate Mr. Trump. “That’s why I’ll be voting for him this fall.”
The endorsement is the latest and most consequential example of leading Republicans falling in line behind Mr. Trump. Mr. Ryan facedsubstantial pressure from fellow Republicans in Congress, many of whom share Mr. Ryan’s misgivings about Mr. Trump, because they realize that high-level public divisiveness over his candidacy only weakens Mr. Trump and increases the political risks of defending their majorities in the House and Senate.
“I think it was always going to be this way,” Representative Tom Cole, Republican of Oklahoma, said. “It was never plausible that a speaker would preside over your convention and not endorse you.”
Mr. Cole said the decision to endorse Mr. Trump would bolster Mr. Ryan’s main priority of protecting Republican seats in the House. “There is just no way that could have been helped by having that division,” he said.
After a sometimes awkward courtship, Mr. Trump said he was happy that Mr. Ryan had finally backed him. “I’m very pleased,” Mr. Trump said in an interview. “I have a good relationship with him, actually. He was taken a little bit by storm because my situation was supposed to go to the convention.”
In an announcement that came while lawmakers were still scattered across the country for their weeklong Memorial Day recess, Mr. Ryan explained Thursday that he had withheld his support until he could discuss his policy priorities with Mr. Trump.
But the speaker, who repeatedly dismissed rumors that he was considering his own presidential run this year and is already considered a contender in 2020, said he would not hesitate to disagree with Mr. Trump.
“It’s no secret that he and I have our differences,” Mr. Ryan said in the column he submitted to The Gazette in Janesville. “I won’t pretend otherwise. And when I feel the need to, I’ll continue to speak my mind. But the reality is, on the issues that make up our agenda, we have more common ground than disagreement.”
Mr. Ryan’s endorsement puts him at odds with Mitt Romney, who selected Mr. Ryan as his running mate in 2012. Mr. Romney delivered ascathing condemnation of Mr. Trump several months ago and has encouraged a third-party challenger to enter the race.
The fact that Mr. Ryan saved his endorsement for a written column precluded, for the moment, a public show of the two men coming together, and there were no plans announced for any joint appearances. Mr. Ryan is expected to focus mainly on campaigning for House candidates in the late summer and fall.
An official with knowledge of the Ryan deliberations, who did not want to be identified discussing internal strategy, said the decision to proceed with the endorsement was made this week by Mr. Ryan personally.
The highest-ranking elected Republican, Mr. Ryan shook up the presidential race in May when he said he was not ready to endorse Mr. Trump. Mr. Ryan had been highly critical of Mr. Trump’s proposal to bar Muslims from entering the country, saying the pledge was anathema to conservative principles and “not what this country stands for.”
The two have spoken numerous times, Mr. Ryan wrote in the column. Last month they sat down for a much-publicized meeting in Washington, emerging to say they had laid the groundwork for reconciliation. The men spoke again by phone last week.
But it was clear that there was still some distance between them. With more Republican lawmakers coming around to endorse Mr. Trump, Mr. Ryan had stayed silent on when, or if, he would join them.
Representative Chris Collins, the New York Republican who was the first member of Congress to endorse Mr. Trump, said Mr. Ryan’s announcement signaled the party’s growing unity.
“Speaker Ryan’s endorsement today reinforces the fact that Republicans are united in our fight to defeat Hillary Clinton,” he said in a statement.
Mr. Ryan’s support will also make for a much smoother convention for both Mr. Trump and the speaker.
Discussion about Mr. Trump was also overshadowing the activities of House Republicans, with Mr. Ryan facing constant questions about his talks with Mr. Trump. Mr. Ryan is hoping to shift the focus to a rollout of a conservative policy agenda when the House returns next week.
The decision by Mr. Ryan also closes a divide with his counterpart in the Senate, Mitch McConnell, the Kentucky Republican and majority leader, who has been openly supporting Mr. Trump, citing the need to have a Republican president to fill Supreme Court vacancies.
Some conservatives seemed sympathetic to Mr. Ryan’s position, if not convinced by his arguments. Tim Miller, who served as communications director for Jeb Bush’s presidential campaign, said Mr. Ryan had “handled a tough situation about as well as he could.”
“But let’s not try to sell this farce that Trump will support House agenda,” Mr. Miller posted on Twitter. “Absurd,” he wrote.
Word of the endorsement came just as Mr. Trump’s likely rival in November, Hillary Clinton, was delivering a blistering attack on his foreign policy positions, warning against giving the country’s nuclear codes to the Manhattan businessman.
Mr. Ryan criticized her in his column, writing: “A Clinton White House would mean four more years of liberal cronyism and a government more out for itself than the people it serves. Quite simply, she represents all that our agenda aims to fix.”
Democrats pounced on the latest opportunity to tie Mr. Trump to Republicans, including vulnerable lawmakers fighting for re-election.