BEIJING — Chinese President Xi Jinping on Wednesday urged a reinvigorated Communist Party to take a stronger role in society and economic development to better address the nation’s “grim” challenges as he opened a twice-a-decade national congress.

Speaking in the Great Hall of the People near Tiananmen Square, Xi laid out his vision of a ruling party that serves as the vanguard for everything from defending national security to providing moral guidance to ordinary Chinese.

He struck a nationalistic line throughout his speech, calling for the party not only to safeguard China’s sovereignty but also to revitalize Chinese culture, oppose “erroneous” ideology and promote religion that is “Chinese in orientation.”

“The great rejuvenation of the Chinese nation is no walk in the park or mere drum-beating and gong-clanging. The whole party must be prepared to make ever more difficult and harder efforts,” Xi told hundreds of delegates, mostly men in dark suits who applauded regularly as they read copies of his prepared remarks. “To achieve great dreams there must be a great struggle.”

Xi outlined a vision in which the party leads China on the road to becoming a “great modern socialist country” by midcentury.

Xi, in his 3½-hour address, said China’s “prospects are bright but the challenges are grim,” a rare acknowledgment of severe economic issues. He said the party would have to take big risks and overcome “major resistance.”

Among the grave issues Xi said were insufficiently addressed are a widening income gap and problems in employment, education, medical care and other areas.

To achieve a “moderately well-off society” by 2021 – the 100th anniversary of the party’s founding – and even greater national power and prosperity by 2049 – the centenary of the founding of the Communist state – China needs continued economic growth and the lifting of millions out of poverty. The country is also rapidly expanding its military and political power, including its growing ability to dominate the Asia-Pacific region.