Herath became the second Sri Lankan bowler to achieve this feat. Earlier, pacer Nuwan Joysa was the first Lankan to claim a hat-trick in Tests.
The veteran left-handed orthodox spinner claimed the wickets of Adam Voges (8), Peter Nevil (0) and Mitchell Starc (0) to complete the hat-trick.
This is a rare feat as previous and only other instance of a left-arm orthodox spinner claiming a hat-trick in Tests (before Herath) was Johnny Briggs' against Australia in Sydney in 1892.
Herath got Starc's wicket on the hat-trick ball after taking the DRS.
After Herath's heroic the Sri Lankan team wrapped up Australia's first innings at 106 in 33.2 overs. This is Australia's lowest total in Sri Lanka which has always struggled on Sri Lankan soil.
The visitor's previous lowest total in Sri Lanka was 120, at Kandy in 2004.