PEBBLE BEACH, Calif. — Rory McIlroy took Johnny Miller’s advice to heart.

Miller, speaking to McIlroy at a Tuesday night dinner gathering of former U.S. Open champions, emphasized the importance of a good start.

McIlroy went out and shot a 3-under 68 in Thursday’s opening round at Pebble Beach to stand in the thick of contention, three shots off the lead held by Justin Rose.

“I think my average the first [round] the last three years of this tournament is 70.2, so I’m happy with this,’’ McIlroy said. “It’s my first round in the 60s at a U.S. Open since Chambers Bay in 2015.’’

McIlroy said he’s still riding the high from his victory Sunday at the RBC Canadian Open, where he blew away the field with a final-round 61. It was his second win of the year, following The Players Championship.

“The comfort level in my game is still there,’’ McIlroy said. “I saw really good shots last week, not maybe under pressure, but in a situation where I needed to hit good shots. I was able to do that and that breeds confidence. So I think just confidence and comfort and that’s sort of what I got from last week.’’

McIlroy is seeking his first major championship win since 2014 and fifth of his career. His game has been consistent all year, with six top-5 finishes and nine top-10s.

Scott Piercy expected big things from himself last week at the Canadian Open. It was being played at Hamilton Golf Club, where Piercy won the tournament in 2012. And he missed the cut.

On Thursday, Piercy shot a 4-under 67 to stand two shots out of the lead. He was 5-under through his first six holes, thanks to an eagle on No. 6.

Go figure.

Piercy said he was tired last week after having to play the 36-hole sectional U.S. Open qualifier trying to get into the U.S. Open. He missed getting into the Open by a shot in the sectional, but got in based on being in the top 60 in the world rankings after the Canadian Open.

“Last week was kind of a funny week because I knew I was 60th going into the week,’’ he said. “I didn’t really want to play the qualifier. And you’ve got Canada, where I’ve won, that’s the first time I’ve been back to a golf course where I won in 2012. So you’re kind of amped to play Canada, but then you’re kind of tired because you did 36.

“I end up missing by one [at the sectional], losing in the playoff and played terrible in Canada. So then you’ve got to sit at home and not root against guys, but hope that they don’t kick you out [of the top 60]. I was happy to get in and I was happy with the start.’’

Rory Sabbatini had a hole-in-one on the par-3 12th hole. It was the 45th ace in U.S. Open history and the first since Zach Johnson in 2014 at Pinehurst.

“I just hit it absolutely perfect, and we hit it close to the previous hole,’’ Sabbatini said. “I told my caddie, ‘We’ve been having a lot of close calls, and one is going to go in sooner or later.’ But I wasn’t expecting that.’’

Scarborough amateur Cameron Young, a four-year star at Wake Forest whose father, David, is the head pro at Sleepy Hollow, shot a 4-over 75. The low amateur was Viktor Hovland, who shot 2-under. Jovan Rebula shot a 1-under 70. Brandon Wu, an amateur from Scarsdale who just finished his senior year at Stanford, shot an even-par 71.

Wu, who played Pebble Beach at the U.S. Amateur last year, said his goal for the week is to finish as the low amateur. It’s already been a big year for him as he helped lead Stanford to the NCAA title.

“I’m [playing as] an amateur this week and I’m going to stay amateur all summer, hopefully make that Walker Cup team at the end of the summer and then turn pro from then on,’’ he said.

Graeme McDowell, who won the 2010 U.S. Open the last time it was played at Pebble, shot a 2-under 69 and is in contention again.

“It’s a lot of fun to be back here,’’ McDowell said. “I’ve been here several times now with the AT&T Pro-Am, so I kind of felt like I’ve done the reminiscing and the sightseeing. I wasn’t coming here to focus on 2010. I was coming here to try and compete this week.’’