The Bluebirds had not won any of their last three Championship outings and had lost back-to-back matches going into the visit of Posh, but returned to winning ways in style at the Cardiff City Stadium.
The hosts started slowly and relied on a good save from David Marshall to keep Grant McCann's free-kick out early on, but soon got into their stride and made the win safe before half-time.
Peter Whittingham scored straight from a corner to hand the hosts a fortunate lead just after the half-hour mark, before Rudy Gestede and Haris Vuckic put Cardiff out of sight at the break.
McCann went close for the visitors after the interval, before Gestede struck the crossbar and Whittingham forced Peterborough keeper Joe Lewis into a good save as the hosts cranked up the pressure in the dying stages.
Paul Taylor grabbed a late consolation for Posh, but that did not prevent Cardiff from closing the gap on the automatic promotion places.
The visitors enjoyed the early sights of goal, with Taylor seeing his shot blocked by Anthony Gerrard and Lee Frecklington firing wide from the edge of the area, before Aron Gunnarsson shot over the bar for Cardiff on the volley.
The hosts seemed edgy and required a good save from Marshall to deny McCann's 20-yard free-kick after 17 minutes, while Gerrard nodded over at the other end following Whittingham's set-piece from the left.
Marshall had to be alert once again to hold on to Frecklington's long-range effort in the 27th minute and Lewis fielded Gunnarsson's 25-yard volley moments later as both sides continued to try their luck from distance without success.
It looked as though it would take something special to break the deadlock, and in the end it came in unusual circumstances after 34 minutes.
Whittingham floated in an inswinging corner from the right, which evaded everyone in the Peterborough penalty area and sailed into the back of the net.
The freak strike settled the Bluebirds' nerves and four minutes later they doubled their advantage.
Kenny Miller's effort was deflected out for a corner, which was whipped in by Don Cowie and headed home by Gestede from close range.
Having looked fragile in the first quarter of the match, Cardiff cantered into a three-goal lead at half-time.
On-loan forward Vuckic collected Ben Turner's pass, composed himself well and struck a low drive past Lewis.
After the interval, chances at first came at a premium for both sides.
McCann fired a long-range free-kick wide of Marshall's right-hand post, while Gerrard prevented Taylor's effort from reaching the Bluebirds keeper as Cardiff comfortably absorbed a spell of Peterborough pressure.
The home side soon created a bundle of opportunities of their own, however, with Gestede, Miller and Vuckic all failing to find their target with their respective attempts, before Lewis produced a fine save to tip Gestede's 25-yard strike over the bar.
Gestede then went within inches of scoring Cardiff's fourth of the evening after 69 minutes, but the Frenchman's header struck the woodwork from Cowie's corner.
Taylor converted Lee Tomlin's pass in second-half stoppage-time to give Peterborough's travelling contingent something to cheer.