Minutes after it became clear that Javier Milei had been elected president of South America’s second-largest nation in November, Elon Musk posted on X: “Prosperity is ahead for Argentina.”

Since then, Mr. Musk has continued to use X, the social network he owns, to boost Mr. Milei. The billionaire has shared videos of the Argentine president attacking “social justice” with his 182 million followers. One doctored image, which implied that watching a speech by Mr. Milei was better than having sex, is among Mr. Musk’s most viewed posts ever.

Mr. Musk has helped turn the pugnacious libertarian into one of the new faces of the modern right. But offline, he has used the relationship to press for benefits to his other businesses, the electric carmaker Tesla and the rocket company SpaceX.

“Elon Musk called me,” Mr. Milei said in a television interview weeks after taking office. “He is extremely interested in the lithium.”

Mr. Musk has declared lithium — the silvery-white element that is the main component in Tesla’s car batteries — “the new oil.” Tesla has long bought lithium from Argentina, which has the world’s second-largest reserves. Now Mr. Milei is pushing for major benefits for international lithium miners, which would likely give Tesla a more stable — and potentially cheaper — flow of one of its most critical resources.

Mr. Milei is part of a pattern by Mr. Musk of fostering relationships with a constellation of right-wing heads of state, with clear beneficiaries: his companies and himself.