The Warriors looked to be lining up an incredible come-back with Cameron Bancroft and Shaun Marsh putting on a 179-run opening stand.
Bancroft's defiant 86 against a Test strength NSW attack was the highest score this season by a wicketkeeper in a Shield game.
But the innings went into freefall after 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.
Fellow Test hopeful Hilton Cartwright collected a pair and lasted just 11 balls across the two innings.
Starc was wicketless until he mopped up the Warriors' tail for the second straight day.
It was the first time in Australia that a first-class cricket a bowler had taken two hat tricks in a game.Starc had Jason Behrendorff caught behind and bowled David Moody with the last two balls of his 15th over.
He 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 other wickets were shared and the earlier damage done by Starc's three Test colleagues, paceman Josh Hazlewood (3-49) and Pat Cummins (2-52) and spinner Nathan Lyon (2-56).
Earlier on Tuesday, 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.