LIVERPOOL, England (AP)Liverpool fans held their collective breath and diverted their eyes to the referee.

Had Joel Matip’s 89th-minute header crossed the line for a goal to seal a crucial win, even at this early stage in the Champions League?

The match official looked at his watch, gave the signal and Anfield went wild.

With a late goal needing confirmation by goal-line technology, Liverpool beat Ajax 2-1 on Tuesday to claim its first points in this season’s Champions League.

”I wasn’t sure, to be honest,” Matip said about his winner that ended his nine-year goal drought in the Champions League. ”When I saw the referee (award it), the emotions came out.”

It wasn’t just the result that was huge for Liverpool. It was also the way the English team performed, a week after the humiliation of its 4-1 loss at Napoli in the opening round of Group A games.

The pressing was better. The intensity was higher. Thiago Alcantara’s display in central midfield in his first start of the season after injury was hugely encouraging, knitting the team together.

This was more like Liverpool, even if the team wound up needing a last-gasp goal to see off the Dutch champions.

”Coming back from the horror show in Naples, it was important we showed a reaction,” Liverpool defender Virgil van Dijk said. ”It wasn’t easy . but it’s something to work on.”

Looking to make amends for that defeat in Italy which manager Jurgen Klopp described as the worst performance in his seven-year tenure, Liverpool started strongly and Mohamed Salah ended his run of seven Champions League games without a goal by putting the team ahead in the 17th.

Luis Diaz headed on a long clearance from goalkeeper Alisson Becker, Diogo Jota collected the ball and played the ball across to his right, and Salah took one touch to steady himself before shooting low inside the post.

Mohammed Kudus smashed a shot in off the underside of the crossbar for the equalizer in the 27th after Ajax midfielder Edson Alvarez ran in behind Trent Alexander-Arnold and cut a cross back into the penalty area.

Liverpool was the better team for the majority of an end-to-end game but after substitute Darwin Nunez swept a shot wide and Salah hit a deflected effort against the post, it looked like it wasn’t going to be the home team’s night.

But after Matip’s late intervention – he met an outswinging corner with a header that had just crossed the line before being cleared away by a covering Ajax player – Liverpool will head into back-to-back group games against Rangers after the international break in good heart.

”I think everyone understood we had to put in a completely different shift for the game,” Klopp said. ”We did that.”

Ajax was coming off a 4-0 win over Rangers last week.

Before kickoff, there was a period of silence as a tribute to Queen Elizabeth II, who died last week at the age of 96. It was respectfully observed, except for a few random shouts that were quickly hushed.

It was Liverpool’s first game since the queen’s death. Players from both teams wore black armbands for the game.

More AP soccer: https://apnews.com/hub/soccer and https://twitter.com/AP-Sports