Manchester United's standout strikers teamed up in the last 10 minutes to put the Red Devils into the knockout phase with two games to spare after they went out last season in the group stage.
But it was the second time in two weeks United had to fight back after Braga took the lead, and the Premier League leader looked tame and far below the form of a contender for the European crown. Braga is making just its second appearance in the competition.
Hernandez tapped in from short range in injury time after Rooney scored from the penalty spot in the 84th following Nuno Coelho's tackle.
Van Persie had equalized on the break against the run of play, hitting a left-foot lob over Braga goalkeeper Beto for his third goal in four games in the tournament.
Ferguson, who on Tuesday marked 26 years at the team's helm, had said he would use more experienced players in the tournament this season. He picked Ryan Giggs in his starting lineup, but he left out Rio Ferdinand, who turned 34 on match day. Fast-paced Danny Welbeck and Javier Hernandez were in attack while in-form striker Van Persie started on the bench.
For most of the game Braga was the most dangerous team, and the 49th-minute penalty from Alan — who got both of Braga's goals in its 3-2 loss at Old Trafford two weeks ago — gave the home team a deserved lead after Jonny Evans bodychecked Custodio as the midfielder burst into the visitor's area.
The game was suspended for about 10 minutes in the second half because of a floodlight failure.