Aitor Karanka has been appointed Birmingham's new head coach on a three-year deal.
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, with Birmingham 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 the former Real Madrid assistant 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 because of concerns over their project.
He has been out of work since leaving Forest in January 2019, having previously guided Middlesbrough to the Premier League in 2016.
Slavisa Jokanovic turned down an approach from the club before they targeted Karanka, while former manager Chris Hughton was not keen on a return.
Paul Cook and Steve McClaren were interested in the role, while ex-Leeds boss Paul Heckingbottom was also spoken to before he took a job as Sheffield United's under-23 manager.
Birmingham survived in the Sky Bet Championship by two points after failing to win any of their final 14 games.
Karanka faces a rebuild after Jude Bellingham was sold to Borussia Dortmund and loanees Scott Hogan and Jake Clarke-Salter returned to Aston Villa and Chelsea respectively.