Ilias Chair scored both goals as QPR returned to winning ways.
They rode their luck at times during an even first half but got the result they needed after three consecutive league defeats.
Chair gave them the lead on 34 minutes with help from a deflection off Marc Roberts.
Moses Odubajo crossed from the right and, after Chris Willock failed to connect with an attempted volley, the ball dropped to Chair on the left-hand side of the penalty area.
Defender Roberts tried to block the Morocco international’s shot with a diving header but succeeded only in helping the ball past keeper Matija Sarkic.
Earlier, Sarkic produced a fine save to deny Charlie Austin at point-blank range after Chair had laid the ball back from the left for the striker.
But the best chance prior to the opening goal fell to Birmingham’s on-loan Manchester United youngster Tahith Chong.
Troy Deeney at the far post nodded Jeremie Bela’s left-wing cross back towards the Dutchman, who misdirected his header into the grateful arms of stranded keeper Seny Dieng when it seemed easier to score.
Rangers, without injured captain Stefan Johansen, had another let-off before taking the lead when Deeney was just unable to get to Ivan Sunjic’s low cross from the left after Dominic Ball had lost possession.
Birmingham continued to threaten after going behind and Maxime Colin headed over early in the second half, while substitute Lukas Jutkiewicz fired wide from near the edge of the penalty area.
But there was no way back for the Blues after Chair doubled QPR’s lead by slotting past Sarkic after being sent through on goal by Lyndon Dykes.
QPR (4-1-3-2): Dieng; Odubajo, Dickie, Dunne, Barbet; Ball; Dozzell (Amos 63), Chair, Willock; Austin (Gray 72), Dykes (Adomah 72).
Subs not used: Walsh, Kakay, De Wijs, Thomas.