VILLARREAL, Spain (AP)Villarreal pulled off another surprising Champions League result, this time against sixth-time champion Bayern Munich to boost its hopes of returning to the semifinals for the first time in 16 years.

After making it past the group stage and eliminating Juventus in the round of 16, the modest Spanish club took a big step toward reaching the last four by holding on to a 1-0 victory against favorite Bayern in the first leg of the quarterfinals on Wednesday.

Arnaut Danjuma’s goal early in the first half was enough for Villarreal at the La Ceramica Stadium, with Bayern unable to get past the solid defense of Unai Emery’s squad and losing only for the second time in 30 Champions League matches.

Bayern was unbeaten in its last 22 away games in the Champions League, with 17 wins and five draws in a record run that had started after a loss in 2017 to a Paris Saint-Germain team coached by Emery.

The Germans struggled throughout the match on Wednesday and were glad to leave only one goal down.

”We’ll take the 1-0 result,” veteran Thomas Muller said. ”We know that things could have been a lot worse. We have to pay a lot of respects to our opponents. Now we need to pick ourselves back up for the return leg and hit back.”

The second leg is next week in Munich, where Villarreal will need a draw to get to the semifinals for the first time since its first last-four appearance in the Champions League in 2006. Villarreal stunned Juventus 3-0 in Italy after a 1-1 draw at home in the last 16.

In the other quarterfinal Wednesday, defending champion Chelsea lost 3-1 to Real Madrid in the first leg in London.

”We deserved to lose. We weren’t good today,” Bayern coach Julian Nagelsmann said. ”In the first half, we lacked power in defense and had too few chances. The second half was a completely wild game. We gave up control because we were desperate to score, but we could have conceded two more.”

Villarreal looked in control from the start and Bayern struggled to create significant scoring chances. The hosts threatened the most and had some good chances to add to its lead.

”There was talk about them being favorites and wanting to seal their place in the semifinals tonight, but we came out very hungry, very humble,” Villarreal midfielder Giovani Lo Celso said. ”There’s no doubt they are one of the best teams in the world, but we managed the game well and could have scored even more goals.”

Danjuma opened the scoring in the eighth minute by redirecting a close-range shot by Dani Parejo as the Bayern defense was caught off guard. It was Danjuma’s sixth goal in nine Champions League appearances this season, and seventh in 11 career games in the competition.

Villarreal thought it had doubled the lead in the 41st but Francis Coquelin’s goal from a tough angle was disallowed for offside.

Striker Gerard Moreno twice had opportunities to add to Villarreal’s lead after that. First with a low shot from outside the area that hit the post in the 53rd, and 10 minutes later after intercepting a bad pass by Bayern goalkeeper Manuel Neuer near midfield and missing his long-range shot into the open net. The ball ended up curling too much as Neuer desperately tried to run back into position.

Bayern increased the pressure near the end but again it was Villarreal that nearly added to the lead when substitute Alfonso Pedraza missed from close range on a counterattack in the 87th.

Villarreal did a good job containing Robert Lewandowski throughout the match and he had few opportunities inside the area. He entered the match as the Champions League’s leading scorer with 12 goals from eight matches and had scored seven goals in his last five games in all competitions. The Poland striker is ranked third on the all-time list of Champions League scorers, behind Cristiano Ronaldo and Lionel Messi.

Bayern’s Canadian player Alphonso Davies made his first appearance since Dec. 17 after a long injury layoff because of cardiac issues.

Villarreal, based in a city of about 50,000 people, is playing in the quarterfinals for the first time in 13 years. It qualified for the Champions League by winning last season’s Europa League.

Bayern was eliminated by PSG at this stage last season. The German club made it to the last eight 10 times in the last 11 seasons. The team is playing in the quarterfinals for a record 20th time.

The winner will play either Benfica or Liverpool in the semifinals. Liverpool won the first leg in Lisbon 3-1.

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