The final against England brought out fans of all stripes and rallied girls in both countries to hit the field and play.In the game’s last seconds, Ona Sánchez couldn’t sit still. Then, when the referee finally blew the whistle to confirm that Spain had won the Women’s World Cup, she and the crowd around her — girls, boys, parents and other fans who had gathered to watch the match in Sant Pere de Ribes, near Barcelona — erupted in cheers.“Campeonas! Campeonas! Olé, olé, olé!” Ona and her friend Laura Solorzano, both 11, and draped together in a Spanish flag, sang in the small town’s central cobblestone square as other supporters splashed water from a nearby fountain. The two friends, both players in a local soccer club, said they couldn’t have hoped for a better ending.“It was the first time I watched a World Cup,” Ona said, emerging from a group of dancing children. “And we won! I’m so happy! It fills me with hope.”Laura Solorzano, left, and Ona Sánchez, both 11, seconds after Spain won the Women’s World Cup.Constant Méheut/The New York TimesSpain’s first victory in the Women’s World Cup and England’s run to the final were not only formidable achievements for teams that have transformed into perennial title contenders in the space of just a few years. They were also a fortifying message to the many girls in both countries who have increasingly been taking up the sport: Women, too, can elevate a nation to the summit of world soccer.The final has reflected the increasing interest and investment in women’s soccer in Spain and England, with more and more girls joining clubs and leagues that are growing in size and professionalism — a profound change in countries where soccer was long the preserve of all-powerful men’s teams, and one that is likely to accelerate after this year’s World Cup.“The perception of women’s soccer has changed,” said Dolors Ribalta Alcalde, a specialist in women’s sports at Ramon Llull University in Barcelona. “It is now seen as a real and exciting opportunity for girls. This World Cup, with its high profile, will have an impact on how people view women’s soccer. It will help make a big step forward.”In England, the mood was more somber as the national team’s hopes to follow up its European Championship victory were dashed. Even so, professional and recreational leagues have seen a surge of interest in recent years from women and girls, in a nation that has considered itself the spiritual home of the game. The advancement of the Lionesses to the final has only fueled that optimism.England fans watching in London. Interest in women’s soccer has surged in Britain.Henry Nicholls/Agence France-Presse — Getty Images“It’s a catalyst for change,” said Shani Glover, an equal game ambassador for the London Football Association, which has pledged to encourage women and girls to play at both professional and recreational levels. An advocate for that shift, Ms. Glover said she had seen growing interest in girls signing up to the sport, particularly after England’s European Championship win. “Having the women center stage — it shifts the public’s mind-set,” she said.“If it was like before, I wouldn’t feel motivated; it was quite isolated,” Cerys Davies, 15, said while watching the final from an East London community center. Cerys trains several times a week at a football academy focused on giving underprivileged players a pathway to elite careers. “It’s good that women are getting the recognition and support they need,” she said, adding that she was heartened to see the crowds in the stadium for the final. “It allows me to know that I’ll be supported,” she said.Cerys Davies, 15, trains several times a week at a football academy focused on giving underprivileged players a pathway to elite careers.Isabella Kwai/The New York TimesIn Sant Pere de Ribes, residents did not have to wait for this year’s World Cup to benefit from the new spotlight on women’s soccer.Aitana Bonmatí, the Spanish star midfielder who was named the tournament’s best player, grew up in the town and played for the local youth soccer club for several years. As Ms. Bonmatí rose to success, many girls took up soccer, hoping to follow in her footsteps.“Our club has grown a lot,” said Tino Herrero Cervera, the club’s manager, noting that the number of girls’ teams has jumped from one to 10 since 2014. Girls now make up a third of the club’s players.“To see Aitana become such a great player motivates me,” said Laura, who wants to become a soccer pro herself. Her team won a youth league championship this year with a 14-point lead over the runner-up.“They’re the next Aitana,” Mr. Herrero said of Laura and Ona, grinning. He added that the high caliber of the girls’ play had helped the club rise in the league rankings. “It’s simple,” he said, “we want more girls to play.”Tino Herrero Cervera, the manager of the local youth soccer club, in Sant Pere de Ribes, south of Barcelona.Constant Méheut/The New York TimesThat has not always been the case. Dr. Ribalta, the sports academic, also oversees women’s soccer at Espanyol, a professional club in Barcelona, where she previously played for over a decade. “A girl playing soccer used to be a trauma for the family,” she said.Until recently, she said, female players were sometimes insulted on the pitch and denied access to proper training equipment and professional coaches, and they had to reconcile their sporting ambitions with the impossibility of earning a living from soccer.Women’s soccer teams were long disregarded — if not simply banned, as was the case in England in 1921. The country’s Football Association was alarmed by the popularity of women’s games, which had gained a following while the men’s league was suspended during World War I. The ban was in place for 50 years.In Spain, the women’s national team long lacked elite training facilities and even jerseys designed to be worn by women. It reached its first Women’s World Cup only in 2015, under a long-serving coach infamous for dismissing the players as “chavalitas,” or immature girls.Change came only in recent years. England created a professional domestic league for women in 2018, and Spain followed suit three years later. Corporate sponsors flocked in and elite women’s clubs such as Arsenal and Barcelona Femení started to attract more attention. The Barcelona team won two of the past three editions of the Women’s Champions League.Barcelona players celebrating after winning the Women’s Champions League final against Germany’s Wolfsburg in June.John Thys/Agence France-Presse — Getty ImagesThat trend is filtering down to smaller and more amateur leagues, as well as younger players. In England, the number of teams playing in one girls’ league at Hackney Marshes, a famed playing ground for recreational soccer in East London, expanded to 44 teams from 26 in one season. In Spain, the number of registered female players has more than doubled since 2015, reaching nearly 90,000 today.That is still a far cry from the hundreds of thousands of men playing in both countries. But many are convinced that this year’s World Cup will inspire more girls to take up soccer and join talented youth teams, a pipeline for national women’s teams.“Many girls have watched these players on big screens for several weeks and followed them on social media,” said Soraya Chaoui López, the founder of the Women’s Soccer School in Barcelona, an academy begun in 2017 to help girls play soccer and to promote the role of women in the sport. “They are references they will listen to and imitate. They can look forward to becoming professional players themselves now.”Destiny Richardson, 14, left, and Dejaunel Bass, 15, watched the World Cup final on Sunday in London.Isabella Kwai/The New York TimesLooking up at the faces of the Lionesses loom on the screen in London, Destiny Richardson, 14, said, “Even if we come second, it’s still good.”She added that she was inspired as a player, saying, “You want to be there one day.”In London, a rare young player elated by the win was Mariam Vasquez, 9, who cheered when Spain triumphed, in honor of her family’s Spanish side.“I’m so happy to be with her to watch it,” her mother, Hind Aisha, said, adding that the whole family was supporting Mariam’s own soccer dreams. “I’m very proud — it’s a women’s game.” More