The win returns the Matildas to the last eight of the World Cup for the third straight time, but is the first knockout win for any Australian senior team after the expansion of the Women's World Cup this year.
Australia will return to Edmonton for a quarter-final on Sunday morning, which could be a rematch of the past two Asian Cup finals.
Japan play the Netherlands on Wednesday for the right to play Australia, as the Matildas bid to reach the semi-finals for the first time.
A tactical first half in Moncton was devoid of major chances.
Sam Kerr's sweetly connected volley from Emily van Egmond's corner on 10 minutes rippled the side-netting.
Full-backs Caitlin Foord and Steph Catley were lively attacking options, although the Matildas had their fair share of ragged moments.
With the half-hour mark looming, Formiga dispossessed van Egmond, and forced Matildas goalkeeper Lydia Williams to make a superb save from her swirling long-range strike.
After the halftime break, the rain came down and the match opened up.
The Matildas had a major life on 63 minutes when the unmarked Formiga headed into the post with the rain teeming down.
De Vanna scurried the ball down the other end, teeing up van Egmond, who shot wide.
Brazil's long-range strikes looked increasingly likely to beat Williams but the keeper held strong.
By 72 minutes, both Gorry and Simon were on the field and, less than 10 minutes later, they made their impact.
After holding out a largely flat Brazilian attack, the Matildas had their slice of history and celebrated wildly on the final whistle.
-AAP