Mashrafe announced his retirement from the game's shortest format during Bangladesh recent series against Sri Lanka.
Shakib's appointment was confirmed in a meeting of the Bangladesh Cricket Board at its headquarters in Dhaka.
"Since Mashrafe has retired, the board unanimously agreed to appoint Shakib as Bangladesh's next captain for Twenty20 internationals," BCB president Nazmul Hasan told reporters after the meeting.
"A few other names were discussed but in the end we all have agreed to appoint Shakib," he said.
Shakib, who captained Bangladesh in 2009-11 in all formats of the game, has so far led the team in four Twenty20 internationals, which they all lost.
With his appointment, Bangladesh have now three separate captains for three formats with Mushfiqur Rahim leading the Test side and Mashrafe at the helm of one-day international side.