STANFORD, Calif. – Some wins go smoothly and some, like Oregon’s 68-64 win at Stanford on Sunday, are an exercise in grind-it-out basketball.

“It was a good test for us, especially on the road, scratching and fighting until the end,’’ said Ducks forward E.J. Singler, who scored 10 of his 20 points in the final 5:06 of the game.

Actually, that’s when things finally smoothed out for Oregon. The Ducks had one short-lived, one-point lead in this one until coach Dana Altman decided to keep the ball in Singler’s hands for the final five minutes or so.

Singler made all four of his shots, including two three-pointers, and gave the Ducks a relatively comfortable cushion, 66-64, when he hit a three with 2:47 left. Meanwhile, the Cardinal did not score at all after Josh Owens slammed home his 20th point with 3:46 to go.

“Coach did a good job of setting some plays up for me when I was feeling pretty good about my shot,’’ Singler said. “My teammates really got me the ball in good positions, and I was lucky enough to hit the shots.’’

The win puts the Ducks (19-8, 10-5) in a tie with Arizona for the coveted fourth spot in the Pac-12 standings – the top four teams get a bye in the conference tournament.

Oregon also averted a Bay Area sweep, after Thursday night’s loss at California, and avoided its first two-game losing streak of the season. The same attitude that allowed the Ducks to grind out a win at Maples Pavilion – they snapped a 24-game Maples losing streak here last year – has let them stay away from losing streaks this season.

“When you lose that first one, you’re pretty down,’’ guard Devoe Joseph said. “We have that mentality that we shouldn’t lose any games, and when you have that mentality, whenever you lose one, you get a little mad for the next game.’’

The Cardinal (18-9, 8-7) falls into seventh place in the Pac-12, all but assured of having to win four games in Los Angeles to make the NCAA Tournament.

“It was a four-point game, and shooting 50 percent from the foul line when you shoot 22 free throws, that alone (could have been the difference),’’ Owens said. “But that wasn’t the only place that we could have played better.’’

The Ducks overcame a slow start, failing to score for the first three minutes, until a putback by Olu Ashaolu of an airball. Then they went another four minutes without scoring. They missed 12 of their first 15 shots and turned the ball over four times in that stretch.

But Oregon fought back to tie it at 24-24, only to watch Stanford go on a 7-0 run to regain control.

“I thought we came out kind of flat-footed, kind of not ready to go offensively,’’ Singler said. “I think we turned it around in the second half and ran some better stuff, some better stuff and got better open shots.’’

Again the Ducks clawed back, and with 8:50 left, took a 52-51 lead on back-to-back three-point plays by Ashaolu, who had his second double-double of the season, with 14 points and 10 rebounds. But again the Cardinal answered that with a 7-0 run.

Then Singler took over, scoring 10 points in a five-minute span before Joseph hit two free throws with four seconds left to ice the game – and give Oregon its biggest lead of the day.

It was far from pretty, but Altman said to get a road win when not playing particularly well is satisfying, especially after bitter defeats at Colorado (72-71) and at Cal (86-83) in their previous two road games.

“You want everything to go smoothly and perfectly, but you know that’s not reality,’’ Altman said. “To get one of these after the disappointments we’ve had in a couple of them feels pretty good.’’

Now the Ducks are off until next Sunday, when they travel to Corvallis for the Civil War. Even though it’s a rivalry game, Oregon is a confident road team, its record now up to 5-3 in Pac-12 games away from home.

“We go on road trips, we know how tough road environments are, and we really go with focus and energy and we really are determined to get wins,’’ Joseph said.

Notes: Singler became the 31st member of the 1,000-point club at Oregon (he has 1,015). … Joseph shot just 4 of 13 but reached double figures for the 13th straight game. … The Ducks withstood another strong game from Owens. In his last three meetings with Oregon, Owens is averaging 23 points and 7 rebounds, shooting 68 percent from the floor. … Stanford’s backcourt, though, was another story. After outshooting Oregon State, guards Aaron Bright, Chasson Randle, Anthony Brown and Jarrett Mann were a combined 6 of 26 from the floor.