African flags have been flown over Tiananmen Square. Leaders of African nations have been greeted by dancers, honor guards and children waving flags. They have been escorted in extensive motorcades past banners celebrating “A Shared Future for China and Africa” and giant, elaborate flower arrangements.

China has pulled out all the stops for a gathering of leaders and top officials from more than 50 African nations this week in Beijing, welcoming them with pomp and pageantry. Xi Jinping, China’s leader, has cast his country as a defender of the developing world, one that can push the West to listen to the voices of poorer nations.

“Modernization is an inalienable right of all countries,” he told the gathering on Thursday. “But the Western approach to it has inflicted immense sufferings on developing countries.”

Mr. Xi had hosted a banquet for the visiting officials at the start of the event on Wednesday, after three straight days of back-to-back bilateral talks with nearly two dozen leaders of nations ranging from impoverished Chad to the continental economic powerhouse of Nigeria.

The three-day forum is meant to demonstrate Beijing’s global clout despite rising tensions with the West. Mr. Xi’s courtship of African countries is part of a great geopolitical competition with the United States that has intensified in recent years over Russia’s war in Ukraine and China’s aggressive posture toward Taiwan.

China is “trying to take advantage of the space left by the U.S. and Europe, which are increasingly disengaged with Africa,” said Eric Olander, the editor in chief of the China-Global South Project website. “China sees an opportunity to really step up its engagement, and not necessarily just with money.”