After retiring from first place last time out on Rally GB on the back of three consecutive wins, Tanak entered the Spain weekend 21 points adrift of championship leader Thierry Neuville.
But Tanak was able to capitalise on off-road incidents for his two main rivals to move top on Friday morning.
M-Sport's Ogier held a 3.7-second advantage after Thursday evening's opening asphalt stage but Tanak cut that to a single tenth following the opening run on the short Gandesa gravel leg.
Spain Rally
Liverpool stage plans advance with Spain trip
12/11/2018 AT 12:52
Even still, Tanak thought there was more pace to come - complaining that the Yaris's set-up was too soft.
He moved into the lead on the next test, and heads Elfyn Evans by 11.7s after the event's first loop.
Neuville made the conservative decision to run on the harder compound tyres, despite starting first on the road. On the final stage of the morning he overshot a junction and span.
"I tried to push but in these conditions - being first on the road - there's not a lot you can," he said. "It was a disaster."
The Hyundai driver rejoined after reversing, but as a result he ended the morning eighth - 37.8s adrift of Tanak and 13.4s behind Ogier.
That error allowed Evans' run of consistency quick times in his Ford Fiesta to take him second. Hyundai duo Dani Sordo, who is a further 7.5s back in third on his return, and Andreas Mikkelsen head Ogier.
Sixth-placed Sebastien Loeb is just three seconds further back, on what is the nine-time WRC champion's final of three planned 2018 appearances for Citroen.
Jari-Matti Latvala's surprise at his initial pace was undone when he suffered a suspected broken suspension arm on the final stage.
On the rally's third stage, he beat Toyota team-mate Tanak by 1.9s, saying: "I'm surprised! I said to Miikka [Anttila, co-driver] I didn't know if we were going too slow or too fast.
"We were sliding a lot, but it seems to be working! Our confidence is improving step-by-step."
His mechanical woes meant he dropped to 10th behind the other Yaris of Esapekka Lappi, who also lost time when he fell off the road and into the overgrowth, blaming persistent brake locking.
Eric Camilli had ended the opening superspecial in sixth place overall as the Volkswagen Polo GTI R5 makes its competitive debut. He has now dropped to 12th, but still leads WRC2 ahead of newly-crowned champion Jan Kopecky's Skoda Fabia.
Leading positions after SS4
Spain Rally
Loeb takes shock Rally Spain lead on final day
28/10/2018 AT 09:59
Spain Rally
Latvala takes slender Rally Spain lead
27/10/2018 AT 16:48