PORTLAND — Even with a 12-4 lead late in the first quarter, Greely never got comfortable.

York did. In a hurry.

The Wildcats closed the first half with a 30-6 run and went on to a 64-38 victory in a Western Class B boys’ basketball quarterfinal Saturday at the Expo.

Second-seeded York (18-1) will play No. 3 Cape Elizabeth in a semifinal at 7:30 p.m. Thursday at the Cumberland County Civic Center.

“We never got comfortable,” Greely Coach Travis Seaver said. “Our kids played hard but the bottom line is York’s a very good basketball team. Our goal was to (reach the tournament) and see what happens. Everyone would like to have had a few more wins, but our kids worked hard and we got better every day. I’m proud of them.”

Mike Gallagher scored 14 points, and Hayden Webster had 13 points and 10 rebounds for the Wildcats, who reached the semifinals for a third straight year. Aaron Todd had 10 points and eight rebounds, and broke the 1,000 career-point barrier.

Seventh-seeded Greely (10-10) looked early like it might replicate the team play that earned a 71-51 win over Fryeburg Academy in a preliminary-round game Tuesday. The Rangers jumped out to a 9-2 lead, but Webster scored eight points and Gallagher capped an 11-0 run with a 3-pointer at the buzzer, putting York ahead 15-12.

“Webster’s the X-factor,” York Coach Randy Small said. “He kept us in the game in the first quarter.”

“We came out tight,” said Webster, “then we loosened up and started to play our game.”

Precisely what Small wanted.

“We started playing defense, running, pounding the ball low and our perimeter shooting was on,” Small said. “It was just fundamental basketball.”

With 6:19 left in the third quarter, Todd’s layup rolled around the rim and dropped, setting off a thunderous cheer. The basket pushed York’s lead to 37-18 and broke the 1,000-point career mark for Todd.

“The best part of that was he got it in the flow of the game,” Small said. “It’s great for him to get it over the four years he’s been here.”

York called a timeout, congratulated Todd and resumed play.

“Todd’s very tough inside, (guard Zach Leal) is a great slasher and Gallagher shot very well,” Seaver said. “When you have to cover all three of those things, it makes basketball very easy for them and very difficult for anyone playing them.”

Michael McDevitt led the Rangers with 15 points.

Meanwhile, it’s back to work for the Wildcats.

“Monday we’ll have a film session and it’s back to business,” Small said. “We’ve been to this next level two years in a row and we want to take the next step.”