SEATTLE — Brittany McPhee scored 25 points and No. 16 Stanford took an 86-79 win Friday night despite a career-high 40 points from Amber Melgoza and a stern test from last-place Washington.

Melgoza was 14-of-26 shooting and made a career-high five 3-pointers in scoring the most points by a Pac-12 Conference player this season.

Marta Sniezek’s 3-point play with 1½ minutes left gave Stanford a 10-point lead — matching its largest of the night — but Melgoza answered with a 3-pointer and another bucket before the Cardinal made 5 of 6 free throws in the final 37 seconds to seal the win.

Melgoza got Washington (7-21, 1-16) off to big start, making four 3-pointers and scoring 18 points in the first quarter for a 26-18 lead. But McPhee brought Stanford back in the second period, scoring 13 points with Stanford leading 42-35 at halftime.

Both teams shot well from 3-point range, Stanford making 12 of 29 (41 percent) and Washington 13 of 29 (45 percent) but the Cardinal outrebounded the Huskies 38-22, including 19 offensive boards that led to a 27-8 advantage on second-chance points.

Stanford (20-9, 14-3) — with Seattle Seahawks quarterback Russell Wilson in attendance to see his sister, Anna Wilson, a sophomore guard for the Cardinal — is alone in second place behind No. 8 Oregon (15-2) and a game ahead of No. 12 Oregon State and No. 10 UCLA (both 13-4) with one game remaining.