The former Middlesbrough and Nottingham Forest boss is the club’s sixth permanent manager in three and a half years.
Karanaka told the club’s website: “I’m delighted to be joining a club with the history and fan base that Birmingham City has.
“I share the excitement and determination of everyone here to start working together on all the challenges that lie ahead.
“I want to thank the board for their willingness and the strong interest they showed in making me the head coach of this project.”
The move was close to collapsing earlier in the week. That’s after Birmingham appeared reluctant to give Karanka greater control over transfers and allow him to bring in several members of coaching staff.
But they have managed to strike a deal for Karanka to replace Pep Clotet, who left St Andrew’s earlier this month.
Karanka previously turned Blues down in 2017 as they looked for a replacement for Harry Redknapp.
He has been out of work since leaving Forest in January 2019, having previously guided Middlesbrough to promotion in 2016.
Slavisa Jokanovic turned down an approach from the club before they targeted Karanka. Former manager Chris Hughton was also not keen on a return.
Paul Cook and Steve McClaren were interested in the role. Blues also spoke to former Leeds boss Paul Heckingbottom before he took a job as Sheffield United’s Under-23 manager.
Karanka faces Birmingham rebuild
Karanka faces a rebuild after Jude Bellingham was sold to Borussia Dortmund. Loanees Scott Hogan and Jake Clarke-Salter have also returned to Aston Villa and Chelsea respectively.