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.
Make your contribution to independent news
A donation of any size to InDaily goes directly to helping our journalists uncover the facts. South Australia needs more than one voice to guide it forward, and we’d truly appreciate your contribution. Please click below to donate to InDaily.