Fulham were indebted to summer signing Kevin McDonald for preserving their unbeaten start to the season after an absorbing encounter with Cardiff City threatened to ebb away from them during the second half. The home side, whose initial dominance was only partially reflected by teenager Ryan Sessegnon’s first senior goal just before the break, looked set to throw away all their hard work – trailing to two terrific strikes from Joe Ralls and Anthony Pilkington – before McDonald’s accurate effort from 20 yards hauled them level four minutes from time.

It was exactly the sort of contest that Slavisa Jokanovic’s side would have lost season. They had started with the confidence and purpose of a side enjoying the early optimism provided by an encouraging start to the campaign – but that verve drained out of the hosts after Cardiff were rewarded for being more enterprising than their own cautious first half approach. Fulham were rocked on their heels by the sublime quality of the finishes from Ralls and Pilkington, which came just five minutes apart, and were fortunate not to be out of the contest altogether when Peter Whittingham’s fine free-kick somehow bounced down off the bar, struck David Button and rolled away from goal.

Fulham’s character and resilience – two qualities that were often missing their last forgettable Championship campaign – dragged themselves back into a game that had seemed well within their control. Without the calmness of both McDonald and Scott Parker at the base of the midfield, the game could have spiralled out of their reach. As it was, the introduction of Matt Smith provided more of a focal point up front and McDonald set up a barnstorming conclusion with a measured finish from just outside the box.

Jokanovic had opted to offer Cauley Woodrow an opportunity to lead the line up front, but the former Luton forward’s only real sight of goal came early and he scooped a shot on the turn high into the Putney End. There were few clear chances, with McDonald shooting wide of goal after he latched onto a loose Cardiff pass, before Fulham eventually made their territorial dominance pay in the final minute of the first period. Sessegnon, who only replaced the injured Floyd Ayite three minutes earlier, showed a poacher’s instinct to ghost into the centre forward position and profit from some fine wing play from Sone Aluko to prod home from close range – becoming Fulham’s youngest ever goalscorer in the process.

Cardiff had largely been toothless in the first half – with lots of pretty passes between the central midfield trio of Icelandic European Championship tyro Aron Gunnarsson, Rails and Whittingham – but little in the way of end product. Paul Trollope read the riot act at half time and his side emerged enlivened as Fulham inexplicably failed to press home the advantage Sessegnon had handed them before the break. The Bluebirds pressed for an equaliser which arrived on the hour mark through a splendid 25-yarder from Rails on the edge of the box after Fulham had failed to clear a Gunnarsson long through.

Substitute Kadeem Harris served further notice of Cardiff’s threat by cutting in from the right and drawing a smart save from Button as he tried to find the far corner, but Fulham failed to heed the winner. The contest was turned completely on its head by Pilkington, who made the most of far too much space, to carry the ball deep into Fulham territory, dart away from Michael Madl and bend a brilliant finish beyond Button from long range. The home defence were culpable for giving the makeshift striker far too much room to line up his shot but it was still a finish of the highest quality.

Smith immediately posed problems for Cardiff’s defence – although he will feel he should have done better than merely guide an inviting cross from Aluko into the arms of David Button and, as Fulham threw more bodies forward in such of a late leveller, Lasse Vigen Christensen was denied by a superb last-ditch intervention from Sean Morrison. It seemed as if Cardiff would hold on for two wins on the bounce but McDonald had other ideas. Found by an Aluko pass, there seemed little danger when the ball arrived at his feet, but the low back lift and the precision of his shot left even a goalkeeper of Marshall’s quality helpless.

FULHAM (4-2-3-1): Button; Odoi, Malone (Christensen 71), Madl, Kalas; Parker, McDonald; Ayite (R. Sessegnon 41), Cairney, Aluko; Woodrow (Smith 61). Subs (not used): Joronen, Ream, Tunnicliffe, Jozabed.

BOOKED: Madl.

GOALS: R. Sessegnon (44), McDonald (86).

CARDIFF CITY (5-3-2): Marshall; Richards (Harris 59), John, Peltier, Morrison, Connolly; Gunnarsson, Ralls, Whittingham (Ecuele Manga 90); Pilkington (Gounongbe 83), Immers. Subs (not used): Wilson, Huws, Zohore, Noone.

BOOKED: Richards, Whittingham.

GOALS: Ralls (60), Pilkington (65).

REFEREE: Jeremy Simpson (Lancashire).

ATTENDANCE: 15,401.