BEIJING--China's foreign-exchange reserves rose in July for a fourth straight month amid a weakening dollar and the country's recovering export sector, official data showed Friday.

The country's hoard of foreign exchange increased by $42.06 billion to $3.154 trillion at the end of July, according to data released by the People's Bank of China.

Economists polled by The Wall Street Journal had expected a $30 billion rise in reserves in July. In June, China's foreign-exchange reserves increased by $10.64 billion.

The U.S. dollar dropped 1.34% against the Chinese yuan last month. Meanwhile, the U.S. dollar index dropped 4.0% in July, compared with a 0.89% fall in June, according to information provider Wind.

Write to Singapore Editors at singaporeeditors@dowjones.com