Lionel Messi won and then scored a penalty before the 17-year-old Ansu Fati contributed to two brilliant goals, volleying in one for himself and then setting up another for Philippe Coutinho.
Barca’s defensive frailties were never far away at Camp Nou and Gerard Pique was sent off before the hour for preventing Tokmac Nguen from finishing in the penalty area.
Ihor Kharatin converted the spot-kick but late goals from Pedri and Ousamane Dembele ended any hopes of a comeback and gave Barcelona some much-needed momentum ahead of Saturday’s Clasico in La Liga against Real Madrid.
A big win also puts Barcelona top of Group G but Pique’s red card means he will miss next week’s game away at Juventus, who had earlier beaten Dinamo Kiev.
That game in Turin will be a greater test of Barca’s capabilities under new coach Ronald Koeman but at least his players were smiling again, 67 days on from their 8-2 embarrassment in Lisbon.
Fati was the star, his goal making him the first player under the age of 18 to have scored twice in the Champions League.
But it was a good night for Barcelona’s youngsters overall, as Francisco Trincao, preferred to Antoine Griezmann down the right, impressed, before another 17-year-old Pedri came on to score his first goal for the club.
Ferencvaros, under coach Sergiy Rebrov, came through four qualifying rounds to become the first Hungarian side to make the group stage in 11 years.
They created several good openings, starting early as Nguen found the top corner only to be ruled offside and Isael rattled the crossbar from eight yards.
But Barca were threatening as well and when a weaving Messi was finally brought down at the third attempt, he was able finish from the spot and make it 16 seasons in a row scoring in the Champions League.
Fati, set up by the busy Trincao down the right, was denied by an excellent save and Messi hit the crossbar from a one-on-one, although the flag was up.
Eldar Civic could have equalised for Ferencvaros and they were punished as Fati set back to Frenkie de Jong before scampering in behind and volleying in the Dutchman’s looped pass over the top.
Fati helped make it three shortly after half-time as Messi found him on the edge of the box. Fati back-peddled to make space and flicked the ball behind his standing leg out to Coutinho, who shot inside the post.
Pique protested but could have few complaints when he dragged down Nguen, who would surely have scored after racing clear.
Kharatin converted the penalty and there might have been a nervy finish if Nguen’s shot was not well-blocked by the sliding Clement Lenglet.
Instead, Pedri, on as a substitute, tucked in his first and Barca’s fourth, with Dembele making it five with one minute left.
For more news your way, download The Citizen’s app for iOS and Android.
Download our app and read this and other great stories on the move. Available for Android and iOS.