Midfielder Julie Ertz puts the Americans ahead in the 11th minute at Avaya Stadium. (Eric Risberg/Associated Press)

The top-ranked U.S. women’s national soccer team capped the 2017 schedule Sunday with a 3-1 victory over fifth-ranked Canada at Avaya Stadium in San Jose. Julie Ertz scored in the first half, Alex Morgan broke a tie early in the second and Carli Lloyd added her 98th international goal five minutes after entering as the Americans finished the year on an eight-match unbeaten streak (7-0-1) and with a 12-3-1 mark overall.

In two sold-out friendlies over four days, the neighboring rivals played in front of some 47,000 spectators overall in Vancouver and San Jose. The Americans are now 48-3-7 against Canada since first meeting 31 years ago.

Both teams will turn attention next year to qualifying for the 2019 World Cup. The eight-team CONCACAF tournament, to take place next fall at a venue to be announced, will include the United States, Canada, Mexico and five teams that must go through pre-qualifying competitions in Central America and the Caribbean. Three nations will qualify for the World Cup in France.

Ertz’s goal:

Janine Beckie’s equalizer for Canada:

Morgan’s goal:

Lloyd’s goal:

U.S. lineup: Naeher; Smith (Short 66th), Dahlkemper, Sauerbrunn, O’Hara; Mewis (Lloyd 75th), Ertz (Sullivan 75th), Horan; Press (Williams 82nd), Morgan, Rapinoe.

Did not play: Harris, Sonnett, Long.

Not in uniform: Campbell, Franch, Ubogagu, Huerta.