Cardiff survived a scare to end the FA Cup run of minnows Chasetown in their third-round tie at the Scholars Ground.
Aaron Ramsey headed Cardiff into the lead at Chasetown
Chasetown threatened a shock when Ben Steane's cross was put into his own net by Cardiff defender Kevin McNaughton.
Cardiff wobbled but equalised in first half injury time as Peter Whittingham curled a left-foot shot home.
After the break Cardiff took control, Aaron Ramsey heading home in his first FA Cup appearance, before Paul Parry's low drive sealed the win.
As might be expected from a side six divisions above their hosts, Cardiff bossed the early exchanges although without threatening the Chasetown goal.
In classic underdog style Chasetown, who play in the British Gas Business Southern League Division One Midlands, defended deep and waited for a mistake.
Cardiff duly obliged in the 17th minute as the Championship side's offside trap failed spectacularly.
Steane timed his run down the right to perfection and the Chasetown midfielder collected a return pass before delivering a dangerous low cross into the Cardiff box.
McNaughton managed to get ahead of lanky Scholars front man Kyle Perry, but the Cardiff defender only succeeded in scooping the ball into his own net.
With a potential upset now very much on the cards, Cardiff pressed for an equaliser but were unable to get their passing game going on a sticky, muddy pitch.
Whittingham fired a free-kick high and wide, while Parry had a goal-bound shot blocked as Chasetown scrambled and harried in defence.
Scholars goalkeeper Lee Evans had coped well with the regulation work that had come his way, but on 43 minutes needed to make a fine full-length save to deny Whittingham.
That signalled a period of sustained pressure by Cardiff as Chasetown were forced to defend a series of corners.
But with moments remaining until the half-time whistle, Cardiff broke their hosts' resistance to equalise.
Ramsey's incisive pass found Steve MacLean in the Chasetown box with his back to goal, the striker laying it back for Whittingham to clip a left-foot curler inside the post.
After their first-half scare, Cardiff emerged after the break in a more determined mood.
The Bluebirds soon had what seemed a decent penalty shout turned down as Peter Capaldi went sprawling over a trailing leg, and was then booked for diving by referee Graham Laws.
But the Northern Ireland full-back shrugged off his scolding to help put Cardiff into the lead.
Capaldi floated a hanging cross to the back post that Parry nodded back across goal, Ramsey arriving at pace to head home from close range.
It was a fine reward for the youngster, impressive on his first FA Cup outing, who only turned 17 on Boxing Day and has just signed his first professional contract.
Chasetown brought on Danny Smith, the goal-scoring hero from the second-round win over Port Vale, who was soon proving a handful with his pace and close control.
But Cardiff made the game safe with a third goal on 73 minutes, Joe Ledley's pass across the left channel allowing Parry to strike the ball through Evans' legs into the net.
Although Chasetown's FA Cup adventure is ended, at least for this season, they have made history by being the lowest-ranked side to ever reach this stage of the competition.
The players deservedly took a lap of honour after the final whistle, in front of the 2,420-crowd fully appreciative of what their team has achieved.
Chasetown manager Charlie Blakemore:
"I was really in dreamland when we scored and it's just a shame that we couldn't have perhaps held the lead until half-time.
"I can be really proud of what we've achieved, even today we were still in it. Second half, they were passing it for fun but our lads just kept running and working.
"I'm the proudest man in the whole of the world today of my lads because they have been just awesome."
Cardiff manager Dave Jones:
"Everyone was here for the fairytale, we just happened to be the party-poopers.
"I am very honoured to be part of their history because it's been a big day for them. That's what all the headlines should be.
"Once we got control in the game it was always going to be how many, but their players were magnificent."
Chasetown: Evans, Thomas, Slater, Williams, John Branch, Hawkins, Holland (Spacey 77), Steane, Mark Branch, Perry (Edwards 79), Perrow (Danny Smith 56).
Subs Not Used: Sargeant, Sam Smith.
Goals: McNaughton 17 og.
Cardiff: Oakes, McNaughton, Loovens, Johnson, Capaldi, Whittingham, Rae, Ramsey (Blake 89), Ledley, Parry, MacLean.
Subs Not Used: Forde, Hasselbaink, Purse, Thompson.
Booked: Capaldi, Loovens.
Goals: Whittingham 45, Ramsey 60, Parry 73.
Ref: Graham Laws (Tyne & Wear).
BBC Sport Player Rater man of the match: Cardiff's Aaron Ramsey 7.58 (on 90 minutes).
Please note that you can still give the players marks out of 10 on BBC Sport's Player Rater after the match has finished.