CAPE ELIZABETH — First Eric Kinkead picked his spot. Then he picked up his first career varsity goal.

Kinkead, a senior defender at Greely High, rose up and headed in an artfully placed free kick from Dylan Fried to break a scoreless tie with 27:31 left, paving the way for the sixth-seeded Rangers to upset third-ranked Cape Elizabeth 2-1 in a Class B South boys’ soccer quarterfinal Tuesday night.

“Before the play I kind of signaled to Dylan, put a hand above my head in the general vicinity of where the ball should be because we had a little bit of space,” Kinkead said.

“He put it right on the money and I was able to make it happen.”

Greely pushed the lead to 2-0 with 1:51 to play when Owen McIntyre buried a hard shot from 18 yards into the top right corner of the net after a slick pass from German exchange student Lucca Pfruender, who drew three defenders during a counter-attack rush.

That goal proved important when Cape answered on a header from Connor Thoreck off a corner kick just 35 seconds later. It made for a tense ending but Cape’s only bids were two long-range shots handled surely by Greely keeper A.J. Eisenhart (10 saves).

Greely (9-7) lost four games by a goal in the regular season, including two to Cape Elizabeth. Coach Mike Andreasen said six of his team’s seven losses came after being tied or leading at the half.

“I knew we had it in us,” Kinkead said. “We’ve been playing hard all year. Coach has been saying that. We knew that. It’s nice to see our hard work pay off.”

The Rangers advance to Saturday’s regional semifinal at Yarmouth (12-2-1), the two-time defending state champion. Yarmouth also beat Greely twice in the regular season.

“We think that we and Cape are evenly matched,” Andreasen said. “We just figured that if two evenly matched teams play three times, usually you split the results. We’ve had some tough luck with them so far, so it was just good tonight to come out and the kids just played relaxed.”

Cape Elizabeth (11-3-1) held advantages of 11-5 in shots on goal and 4-3 in corner kicks.

Both teams had one strong scoring chance in the first half denied by the goalies. Eisenhart was able to get enough on a bid from Matt Concannon off Thoreck’s flicked header to push the ball just over the crossbar.

Later in the half, Cape keeper Sean Agrondia (three saves) knocked away a Greely header with a quick leap to his left.

The Capers started the second half with a string of good possession, paced by strong play in the midfield from Nicolai Sabbatini and Quinn Hewitt, and alert backline wins from Jon Fiutak.

“I think we played pretty well. I think they played pretty well,” Cape Coach Ben Raymond said. “Their (first) goal comes on a free kick that we give up and the kid hits a great ball, and they get on the other end of it.”