The 56-year-old was a hugely popular figure during his first spell as Magpies boss from 1992-1997 but was ranked as an outside candidate to replace Sam Allardyce, who left St James' Park last week after an unsuccessful short stint in charge.
Gerard Houllier and Didier Deschamps were strongly linked with the position in the last two days but the club unexpectedly announced Keegan as the club's new manager on their website on Wednesday afternoon.
Keegan took Newcastle to promotion back to the top flight in 1993 and came close to winning the league title in the 1995-96 season when they famously led Manchester United by 12 points before finishing as runners up.
"Geordie messiah to be unveiled as new manager," read a headline on the club's official website www.nufc.co.uk ahead of Thursday's FA Cup third-round replay at home to Championship side Stoke City.
"Kevin Keegan is returning to Newcastle United as manager," the club added.