Flacco's third touchdown toss of the game, a 31-yarder to Mark Clayton at 2:06, sent the Ravens ahead and McGahee got his second score of the contest on a 1-yard-run with 11 seconds left.
The Ravens (1-0) set a single-game franchise record with 501 yards total offense.
Flacco connected on 26-of-43 passes for 307 yards.
Puzzle-maker slips 'Murdoch Is Evil' into Rupert Murdoch's Sunday Telegraph
Wisconsin business offering 'therapeutic cuddling' forced to close