A rebel alliance in northern Myanmar has agreed to a ceasefire with the ruling military during China-mediated talks, according to some of the parties involved, after a months-long coordinated offensive that threatened to weaken the junta's grip on power.

The military, which overthrew an elected government in 2021, has been battling an alliance of ethnic minority armies fighting to end its control of their regions since late October. In particular, there has been intense violence along the northern border with China.

The joint offensive, backed by a parallel pro-democracy, civilian-led government, has posed the biggest battlefield challenge to the junta since the coup and caused concern in China about the potential for disruptions to border trade and a refugee influx.

A leader of one of the rebel groups, TNLA, told Reuters on Friday that the "Three Brotherhood Alliance" and the military agreed to a "cease fire without advancing further". He declined to be named due to the sensitivity of the matter.

"From the (alliance) side, the agreement is to refrain from offensive attacks on enemy camps or towns. From the military side, the agreement is not to engage in attacks through airstrikes, bombardment, or heavy weapons," he said.

China's foreign ministry said on Friday peace talks were held in the Chinese city of Kunming on Jan 10-11, where "the two sides agreed to immediately cease fire and stop the war."

Both parties also pledged not to harm residents at the Chinese border, said foreign ministry spokeswoman Mao Ning.

"China hopes that all parties concerned in Myanmar will earnestly implement the ceasefire agreement already reached and exercise maximum restraint," she said.

Beijing had also said last month the parties had agreed on a temporary ceasefire and to maintain dialogue.

But fighting continued in northern Shan State and other regions in the country, with the rebels taking control of a key commercial town, Laukkai, on the Chinese border last week.

More than 300,000 people have been displaced due to the recent violence, and more than 2 million overall since the coup, according to the United Nations.

The conflict has also seen Myanmar police and military personnel surrender to rebel groups or flee across borders into India.

A spokesperson for Myanmar's junta did not respond to a request for comment.

The two other groups in the rebel alliance, the Myanmar National Democratic Alliance Army (MNDAA) and the Arakan Army (AA), did not immediately respond to requests for comment on the talks.