HOUSTON — The foreign strategy of soothing tensions with the United States by stroking President Trump’s ego was put into vivid effect here Sunday when Indian Prime Minister Narendra Modi lathered praise on his American counterpart at a massive rally celebrating the Indian diaspora.

The leaders of the world’s two largest democracies took the stage together in Houston before a roaring crowd of tens of thousands of Indian Americans, where Modi delivered an unmistakable endorsement of Trump’s presidency and cast their joint appearance in historic terms.

“His name is familiar to every person on the planet,” Modi said as he introduced Trump. “He was a household name and very popular even before he went on to occupy the highest office in this great country. From CEO to commander in chief. From boardrooms to the Oval Office. From studios to global stage.”

The prime minister then repurposed his own campaign slogan in India to rally support for “my friend” Trump in the United States: “Abki baar, Trump sarkar,” meaning, “This time, a Trump government.”

Modi’s overtures come at a delicate moment in U.S.-India relations. After the United States imposed tariffs on Indian steel and aluminum imports, India has been looking for ways to decrease trade tensions with the Trump administration and stimulate fresh investment.

The two leaders — both center-right politicians who govern with big personalities and stir controversy — are set to attend the United Nations General Assembly in New York this week.

Trump swooped into Houston on Sunday with an unusual role: as a warm-up act.

Called “Howdy, Modi!,” the event was staged to honor the prime minister and was billed as the largest gathering for an invited foreign leader other than the pope. Attendees, many of them from Texas’s large Indian community, packed into NRG Stadium, the 72,000-seat home to the the National Football League’s Houston Texans. Houston is the nation’s most diverse city and home to an estimated 150,000 Indian Americans.

Modi recently invited Trump to join him here, and the president agreed to be a special guest, but the signage and stagecraft made clear that Modi was the main attraction, with his image projected on large screens throughout the arena.

“In Houston, we say ‘Howdy’ in more than 140 languages — and this morning we are saying ‘Howdy’ to Prime Minister Modi,” Houston Mayor Sylvester Turner, a Democrat, told the crowd.

The event pulsed with energy all morning, as artists performed Indian dances and played music onstage. Once Trump arrived, live video of him and Modi walking down a red carpet winding through the bowels of the stadium played on the screens as a drum band played in anticipation of their grand entrance. The two strode onto the stage holding hands.

As Trump stood at his side grinning widely, Modi said he admired Trump’s “concern for every American, a belief in America’s future and a strong resolve to make America great again.”

The prime minister added, “We are witnessing history in the making.”

Trump delivered remarks — and, unlike at his own campaign rallies, did not appear to stray from his script on Teleprompters.

The president highlighted his stewardship of the economy, but drew far most impassioned responses from the crowd when he talked about other issues. The president received a standing ovation when he denounced “radical Islamic terrorism,” and sustained applause when he vowed to stop illegal immigration.

He said Modi was doing “a truly exceptional job” as prime minister, and congratulated him on his overwhelming reelection victory in May.

Trump then took a seat in the audience to watch Modi give the keynote address in his native Hindi.

In the 2016 election, Trump won the support of roughly 14 percent of Indian American voters, compared to 84 percent for Hillary Clinton, according to an analysis by the Asian American Legal Defense and Education Fund.

But Trump made a direct pitch to expand his share of support among Indian Americans in his 2020 reelection. In his speech, he cited the estimated 4 million Indian Americans living here.

“You enrich our culture, you uphold our values, you uplift our communities and you are truly proud to be American — and we are proud to have you as Americans,” Trump said. “We thank you, we love you, and I want you to know my administration is fighting for you each and every day.”

“We are going to take care of our citizens first, our Indian American citizens, before we take care of illegal immigrants who want to pour into our country,” Trump said.

M.R. Rangaswami, founder of Indiaspora and an organizer of Sunday’s event, said there was an opportunity for Trump to improve upon his 2016 vote margin.

“He could hope he could change some minds,” Rangaswami said. “It could happen.”

Sen. John Cornyn (R-Tex.) said Trump was smart to come to Houston and take advantage of the large audience assembled to see Modi.

“Politics being what politics is, it’s really important to show up and to listen respectfully and try to find common ground with these constituents,” Cornyn told reporters. “I don’t think it’s any accident the president decided to come.”

“Of course, he loves a good rally,” Cornyn added. “You might have heard that.”

Later in the day, Trump traveled to Wapakoneta, Ohio, where Australian businessman Anthony Pratt celebrated the opening of his newest cardboard manufacturing plant in the United States and introduced his country’s prime minister, Scott Morrison, and Trump.

“As a result of this paper mill, we are now the largest Australian employer of Americans,” said Pratt, who said his company now employs 9,000 workers in the United States.

After Pratt’s remarks, Trump spoke and lavished praise on Morrison for helping to create a $65 billion annual trade relationship with the United States. “He has become a very good friend of mine, he believes a lot of the same things I do,” Trump said.

Morrison returned the praise in brief remarks, saying: “We are here to celebrate jobs.”

Kevin Williams in Wapakoneta, Ohio, contributed to this report.