Rayan struck deep into added time to spare Brazil's blushes as they drew 1-1 in the first of two friendlies with Australia on Friday, denying the hosts a first win over the five-time world champions in 25 years.
Australia had Carlo Ancelotti's side on the ropes in front of a sold-out crowd in Queensland after Nestory Irankunda netted a free kick in the 68th minute, but Rayan found the target with a header from a corner in the 95th minute.
Ancelotti had said on Thursday that there were no friendlies for Brazil, and Tony Popovic's Australia quickly reminded them why as Irankunda tested visiting keeper Hugo Souza from distance and Jacob Italiano clashed heads with Douglas Santos in an aerial duel in the first 10 minutes.
Brazil gradually seized control, forcing Australia onto the back foot.
Patrick Beach made diving saves to deny Raphinha twice and Estevao thought he had broken the deadlock before halftime, only for VAR to rule out his effort after Harry Souttar was fouled in the buildup.
Australia, whose best chances in the first half came from corners that Alessandro Circati and Souttar failed to convert from close range, weathered sustained pressure early in the second half and took the lead after Paul Okon-Engstler was brought down to win a free kick.
Irankunda's right-footed effort beat Brazil's defensive wall and dipped past the keeper.
The 20-year-old former Bayern Munich winger, who joined Portuguese side Sporting this year, celebrated with backflips in front of a roaring home crowd.
With Australia's only victory over Brazil coming at the 2001 Confederations Cup, the hosts sensed a rare opportunity to claim a landmark result.
Australia held off Brazil's repeated attempts to find an equaliser until added time when Raphinha's corner was met by Bournemouth forward Rayan, whose header found the bottom-left corner.
The teams meet again on Tuesday before Brazil travel to India for a friendly on October 3.

Mercedes' Russell takes Azerbaijan GP pole
Gulf Giants Development win DP World ILT20 Development Tournament
Sinner withdraws from China Open as knee injury recovery continues
Alcaraz calls for end to late-night finishes at Grand Slams
