How can a firewall prevent intrusions?

A firewall can help prevent unauthorized access to your computer. It can be a very effective safeguard against intruders. The firewall acts as a barrier between your computer and the Internet, ensuring that all traffic passes through one regulated area.