Meanwhile, favourites Australia earlier beat Olympic silver-medallists Spain 2-1 to put themselves in line for the second semi-final spot in the group.
The Swedes will play Canada, who are the only team in Olympic history to reach the semi-finals with a perfect nine wins from their nine group matches, in Thursday's semi-final.
Ferrer has won an ATP Tour-leading 73 matches this year, one more than Djokovic -- who will seek to clinch his semi spot in his third and final closing Group A match against sixth-ranked Czech Tomas Berdych on Friday.