The Warriors innings went into freefall after Test aspirant Shaun Marsh was dismissed in the last over before tea for 91.
Chasing 395, WA lost 10-44 to be dismissed for 223 to give NSW a second win from as many Shield matches.
Starc (3-41) was wicketless until he mopped up the Warriors’ tail for the second straight day.
He had Jason Behrendorff caught behind and bowled David Moody with the last two balls of his 15th over.
Starc then had Jonathan Wells caught in the slips by captain Steve Smith with the first ball of his next over, as NSW secured a dramatic win with almost ten overs to spare.
“The shape he gets and the angle he creates from going so wide – it’s difficult for batters alone let alone tail enders,” Smith said of Starc.
“Most people are pretty lucky to take one hat-trick in their career, but two in a game is a pretty fantastic effort.”
It was the first time in Australia that a bowler had taken two hat tricks in a first-class game and over 100 years since an Australian had achieved the feat anywhere.
Australians Albert Trott and Jim Matthews both managed it in England.
Trott did it for Middlesex in a county game and Matthews in a Test against South Africa in Manchester in a triangular Test series.
WA looked poised to mount a serious chase of their testing target after an opening stand of 179 between Marsh and Cameron Bancroft, who followed up his gritty unbeaten first innings 76 with a more fluent 86.
Test hopeful Hilton Cartwright collected a pair and lasted just 11 balls across the two innings.
Josh Hazlewood (3-49), Pat Cummins (2-52) and spinner Nathan Lyon (2-56) worked their way through the top and middle orders, with the quicks reverse swing proving a potent weapon.
“They bowled brilliantly with the reverse swinging ball,” WA coach Justin Langer said.
Earlier yesterday, Smith posted his 34th first-class century, striking 17 fours and a six to get 127 off 167 balls.
The Blues added 134 in 95 minutes before Smith declared at 6-300.
Smith put on 140 with Kurtis Patterson (66) and 85 with Moises Henriques (45) for the third and fourth wickets respectively.
We value local independent journalism. We hope you do too.
InDaily provides valuable, local independent journalism in South Australia. As a news organisation it offers an alternative to The Advertiser, a different voice and a closer look at what is happening in our city and state for free. Any contribution to help fund our work is appreciated. Please click below to become an InDaily supporter.