Four boys among a group of 13 trapped in a flooded Thai cave for more than a fortnight were rescued on Sunday after surviving a treacherous escape, raising hopes elite divers would also save the others soon.

The rescued boys emerged as night fell from the Tham Luang cave complex after divers guided them along a route of more than four kilometres (2.5 miles) that included twisting, extremely narrow and jagged passageways filled with water.

Their escape led to an explosion of jubilation on social media in Thailand as the rescued boys were rushed to hospital.

But the survival of those remaining in the cave is far from guaranteed with extraction efforts put on hold until Monday morning to allow rescue divers time to resupply.

Rescue chief Narongsak Osottanakorn said the four who escaped were "safe" but released few details about their condition or identities.

Footage released by authorities showed groups of soldiers carrying what appeared to be two of the boys on stretchers into the back of waiting ambulances which then sped off for a nearby hospital.

The group became trapped in a cramped chamber deep inside Tham Luang in a mountainous area of northern Thailand on June 23, when they went in after football practice and got caught behind rising waters after a torrential downpour.

Their plight transfixed Thailand and the rest of the world, as authorities struggled to locate them an...