Militants from the Islamic State group have seized a string of villages from Syrian rebels near the Turkish border.

The rapid advances forced the evacuation of a hospital and trapped tens of thousands of people amid heavy fighting, Syrian opposition activists and an international medical organisation said.

The advances in the northern Aleppo province brought the militants to within three two2 miles of the rebel-held town of Azaz and cut off supplies to Marea further south, another rebel stronghold north of Aleppo city.

They also demonstrated the Islamic State group's ability to stage major offensives and capture new areas, despite a string of recent losses in Syria and Iraq.

The IS offensive began on Thursday night. By Friday, the group had captured six villages east of Azaz including Kaljibrin, cutting off rebels in Marea from the Azaz pocket.

The rebels in the area - which include mainstream opposition fighters known as the Free Syrian Army along with some ultraconservative Islamic insurgent factions - have been squeezed between IS to the east and predominantly Kurdish forces to the west and south, while Turkey restricts the flow of goods and people through the border.

The IS news agency, Aamaq, also reported the advance - saying the Islamic State group seized six villages from the rebels.

The humanitarian medical organisation Doctors Without Borders said its team is currently evacuating patients and staff from the Al Salama hospital, which it runs in Azaz, after the frontline shifted to within 2 miles of the facility.

The group, known by its French acronym MSF, said a small skeleton team will remain behind to stabilise and refer patients to other health facilities in the area.

"MSF has had to evacuate most patients and staff from our hospital as front lines have come too close," said Pablo Marco, MSF operations manager for the Middle East.

"We are terribly concerned about the fate of our hospital and our patients, and about the estimated 100,000 people trapped between the Turkish border and active front lines."

"There is nowhere for people to flee to as the fighting gets closer," he added.

Azaz, which hosts tens of thousands of internally displaced people, lies north of Aleppo city, which has been divided between a rebel-held east and government-held west.

A route known as the Azaz corridor links rebel-held eastern Aleppo with Turkey. That has been a lifeline for the rebels since 2012, but a government offensive backed by Russian air power and regional militias earlier this year dislodged rebels from parts of Azaz and severed their corridor between the Turkish border and Aleppo.

The predominantly Kurdish Syrian Democratic Forces (SDF), who are fighting for their autonomy in the multi-layered conflict, also gained ground against the rebels.

In recent months, Syrian rebel factions in Azaz have separately come under fire from the extremist IS group, pro-government forces and the SDF.

MSF and other aid organisations warned earlier this month that the humanitarian situation for more than 100,000 people trapped in the Azaz rebel-held pocket was critical.