The match at the Polish capital's National Stadium saw goals by Poland's Karol Świderski, Tomasz Kędziora, Adam Buksa, and Krzysztof Piątek, as well as an own goal by San Marino's Cristian Brolli.
The match was also a farewell to Poland's goalkeeper Łukasz Fabiański, who played 57 matches for the country's national team, since March 2006.
Poland are ranked 24th worldwide by football's governing body FIFA, while San Marino are last in the FIFA table, at No. 210.
San Marino scored their only goal in the World Cup qualifiers, as on September 5, as they were demolished 7-1 by the Polish team.
Poland on September 8 drew 1-1 with England in their sixth 2022 World Cup qualifier in Warsaw.
After seven rounds of fixtures, Poland are in third place in their qualifying Group I, behind England and Albania, with 14 points.
The Poles will next week travel to Tirana to take on Albania in their next qualifying fixture on October 12.
Manager Paulo Sousa last month released a list of 29 players called up for the national team's October games against San Marino and Albania.
The lineup announced by Paulo Sousa includes star striker Robert Lewandowski and other well-known faces such as Napoli midfielder Piotr Zieliński and Hertha Berlin forward Krzysztof Piątek.
Piątek is returning to the squad after an injury layoff.
Several other players, including defenders Arkadiusz Reca and Maciej Rybus, have succumbed to injuries and missed the match against San Marino, state news agency PAP reported.
Source: PAP