The former Rangers and Scotland boss confirmed his resignation in a note sent to acting chairman Peter Pannu on Sunday.
Blues announced in a statement on their website: "Birmingham City Football Club can confirm that Alex McLeish has resigned as manager.
Acting chairman Peter Pannu received an e-mail resignation from McLeish while away on business in Amsterdam. No further comment will be made at this moment in time and updates will be released in due course."
Former Motherwell, Hibernian, Rangers and Scotland manager McLeish's departure came as the 52-year-old appeared to be rebuilding the squad at St Andrew's for next season's campaign in the npower Championship.
In the past week he had added winger Chris Burke and striker Marlon King to the Blues squad and, after receiving the backing of the club's board following Blues' relegation, he looked set to stay and lead the pursuit of promotion.
McLeish led Blues to Carling Cup final glory last season but their form in the Premier League dipped after their Wembley success, culminating in relegation on a dramatic final day of the campaign.
If the timing of McLeish's resignation came as a surprise, it would be a stunning turn of events if he was handed the top job at Villa.
Bookmakers were moved to declare McLeish their favourite for the Villa job, but several managers have been in that position since Gerard Houllier's departure was announced on June 1st.
Source: PA
Source: PA