Cleo Smith disappeared from her family’s tent at a campsite near the town of Carnarvon on 16 October, triggering a massive search.
A 36-year-old man is in custody and being questioned by detectives.
Police smashed their way into a home in Carnarvon in the early hours of Wednesday, following forensic clues.
«They found little Cleo in one of the rooms,» Deputy Commissioner Col Blanch from WA Police said in a statement.
«One of the officers picked her up into his arms and asked her, ‘What’s your name?’ She said ‘My name is Cleo’.»
The moment four-year-old Cleo Smith was rescued by police
The girl has been reunited with her parents, who had made desperate pleas for Cleo’s return.
«Our family is whole again,» her mother, Ellie Smith, wrote on Instagram.
Police footage of Cleo’s rescue showed her «smiling» and «as well as we could expect in the circumstances», said Commissioner Chris Dawson, who added she was receiving medical care.
Authorities say the man in custody has no connection to the Smith family. No charges have been laid.
The house where Cleo was found is about six minutes’ drive from her family home in Carnarvon, which has about 5,000 residents.
Australian PM Scott Morrison tweeted it was «wonderful, relieving news». Commissioner Dawson said: «I think Australia is rejoicing.»
«To find a little girl — a vulnerable little girl — after 18 days. You know, obviously people think the worst, but importantly hope was never lost,» the commissioner added.
What is known so far?
Cleo’s family were on the first night of their holiday at the Quobba Blowholes camping ground when she went missing between 01:30 and 06:00 on 16 October.
The remote site in Macleod is about 900km (560 miles) north of Perth, and is a local attraction on the state’s Coral Coast — known for its windswept ocean scenery, sea caves and lagoons.
Cleo had been sleeping on an air mattress next to her younger sister’s cot. When her mother, who had been sleeping in the second room of the tent, got up in the morning, Cleo was gone and the tent door was open.
Police said this raised fears of an abduction. Ms Smith was adamant Cleo could not have left the tent on her own.
A taskforce of 100 officers were sent in from the state capital, Perth, to join a massive air, land and sea search. Reconnaissance planes were used to comb sparsely populated areas.
Authorities offered a A$1m ($750,000; £540,000) reward for information on Cleo’s whereabouts.
The case drew international attention, and there were reports that bounty hunters had travelled to the region once the cash reward had been offered.
Deputy Commissioner Blanch said they scoured thousands of pieces of information looking for a «needle in a haystack».
«Late last night they found that needle that led them to that address and rescued Cleo,» he told Network Seven.
Police said it involved information about a car, but would not elaborate.
ABC News reported a man who lived at the house had been recently spotted by a neighbour buying nappies.
«We didn’t click who… he was buying them for,» the neighbour was quoted as saying.
News that Cleo has been found sparked a sense of huge relief in the local community.
«For 18 days we’ve been filled with anxiety and concern,» Carnarvon Shire president Eddie Smith told Australia’s 2GB radio.
Deputy Commissioner Blanch told 6PR radio that it had been «incredible to see seasoned detectives openly crying with relief».
Police said they did not expect the reward to be claimed.