Mahesh Patrick, 14, and Shaun Emitja, 21, had become separated after their vehicle became stuck in the Arlparra and Harts Range area of the Northern Territory outback.
The pair were reported missing by family on Monday after failing to return to Hermannsburg, an Aboriginal community, 120km south-west of Alice Springs. They were not discovered by police until Friday and Saturday after enduring multiple days without food or water.
Police said the pair's vehicle had become bogged down during a four-hour drive last Monday enroute to a sports carnival. Both left to search for water the following morning after an unsuccessful attempt to restart the car.
Detectives said they backtracked after realising they had gone in the wrong direction, and were later separated.
A spokesperson for Northern Territory police said: "They thought they were going in a direction that would [take] them adjacent to the Sandover Highway.
"On arrival at the top of this hill they realised that was not the case, and walked another 5km to another hill."
Mahesh then trekked around 35km on his own before being found by officers. Police said he was dehydrated and had sore feet but was otherwise in good health.
Southern Region Acting Commander Kirsten Engels said: "Mahesh walked approximately 12km to a fence line and spent the next two days and two nights camping and traversing down that fence line another 7km.
"Miraculously, he was located by community members who reunited him with his community and family."
Mahesh then assisted an air police search for Mr Emitja, who was found on Saturday.
Commander Engels added: "They are extremely lucky to be alive — we all know how harsh it is out there.
"For what these boys went through, I can hardly believe they have so [few] scars physically."
Travellers in the Australian outback are urged to carry food and at least four litres of water per day.
Authorities usually advise against leaving a car stranded, as it provides offers shelter and protection from the environment.