Canada crashed to its first defeat of 2022 World Cup qualifying on Thursday as a 1-0 loss to Costa Rica delayed its bid to reach the finals for the first time in 36 years.

With Panama being surprisingly held to a 1-1 draw at home to bottom team Honduras, the Canadians needed only a draw in San Jose to secure their second ever World Cup appearance following the 1986 finals in Mexico.

But the Canadians were rocked after defender Mark-Anthony Kaye was sent off on 34 minutes for picking up his second yellow card of the night.

Costa Rica made the advantage count, and deep into stoppage time at the end of the first half Celso Borges headed home Gerson Torres's cross to score the game's only goal.

Canada battled bravely to get back on level terms after the break, with Tajon Buchanan looking threatening throughout only to be denied by Costa Rica's veteran goalkeeper Keylor Navas.

READ: Italy misses 2nd straight World Cup after shock defeat vs North Macedonia

Jonathan David almost salvaged a goal for Canada but his shot was deflected behind for a corner.

Richie Laryea went close for Canada on 73 minutes but his shot was saved by Navas. Buchanan then hit the bar with a header before a follow-up shot flew just over.

Despite being a man down, Canada finished the stronger of the two teams but was unable to break down a resolute Costa Rica side.

Canada remains on top of the qualifying standings for Central America, North America and the Caribbean (CONCACAF), however, with 25 points and two rounds remaining.

A single point in Sunday's home game against Jamaica at Toronto would seal Canada's qualification for Qatar -- and coach John Herdman backed his side to close out qualification.

"We can take control of our destiny," the Englishman said after Thursday's loss. "We'll take care of business this weekend, and if it doesn't get taken care of there, we'll take care of it in Panama. We will get to Qatar.

"It's a tough loss tonight. We would have loved to put this team in Qatar. But we'll save it for when we get back to our own country. We could have stayed out there until two o'clock in the morning and that goal wasn't going to wilt. You could sense it.

"That's football. We've gone 17 games where we had the football gods with us. They weren't with us tonight. But it's made us hungry to come home and take what we need to take."

US rues missed chances

Elsewhere on Thursday, the United States and Mexico shared the spoils in a hard-fought 0-0 draw at the Azteca Stadium that edged both sides closer to qualification.

The United States headed into the fixture in the knowledge it had never beaten Mexico in a World Cup qualifying game in Mexico City.

But Gregg Berhalter's side carved out the better chances in a scrappy encounter that leaves the two teams level on 22 points with two rounds of fixtures remaining.

Chelsea striker Christian Pulisic should have fired the USA into the lead after 35 minutes, but fired his shot from Timothy Weah's cross directly at Mexico goalkeeper Guillermo Ochoa.

READ: Ecuador, Uruguay book their places for World Cup in Qatar

Second-half substitute Jordan Pefok then squandered a golden opportunity to put the Americans ahead on 72 minutes after being gifted a chance from Gio Reyna.

But with the goal begging, the Switzerland-based striker somehow hooked his shot wide.

"It was a good effort by the group, we dealt well with the conditions and a point will be valuable based on the standings," Berhalter said.

"We talked about coming to Azteca and being the first team to win and we're a little disappointed we didn't. But you can't fault the effort from the guys. We knew it was going to be a game where we dug in and deal with some adversity and the guys did that."

The US coach admitted the team was left ruing not taking all three points.

"The game was there for us to win, unfortunately we just couldn't get that goal," Berhalter said.

"That's part of soccer. That's how it goes. Another day we make those two goals. In this game unfortunately we didn't but I'm proud of the effort of the group."

The United States faces Panama on Sunday in Orlando, where it could clinch qualification with a win if Costa Rica fails to take all three points in its away game against El Salvador.