The five-time winner of the championship was cruising against the 76th-ranked Matesovic with a two-set lead and a break in the third before his Aussie foe broke back to eventually force the tiebreaker.
"It was a bit more difficult than I thought it was going to be," admitted Federer, who is seeking an 18th Grand Slam title but his first since Wimbledon 2012.
He will face another Australian, 104th-ranked Sam Groth for a third-round berth.
On the sidelines of the tournament, Federer met NBA icon Michael Jordan for the first time as the former basketball player watched the Swiss champion play.
Federer and Jordan both have longtime commercial deals with apparel maker Nike.
In Tuesday's match, the Basel native debuted a new Nike shoe, the Nike Zoom Vapor 9 Tour AJ3.
It is designed to resemble the Jordan 3, a sneaker released in 1988.
In a courtside interview with ESPN Jordan admitted he knew nothing about tennis but could appreciate Federer's smooth movement on court.
"He's a good athlete," said Jordan of the tennis player, who sat in Federer's box and received cheers when his image was shown on Arthur Ash Stadium's video screens.