Routers do the job of a basic firewall, but it is not the same thing. We go into more depth with this answer here, but basically, routers automatically discard incoming traffic requests that aren't on your network, and firewalls block unauthorized external traffic. Routers also mostly work on a hardware level, while firewalls are based on software.