Before emissions laws were enacted, it was possible to build a car engine without microprocessors. With the enactment of increasingly stricter emissions laws, sophisticated control schemes were needed to regulate the air/fuel mixture so that the catalytic converter could remove a lot of the pollution from the exhaust. (See How Catalytic Converters Work for more details.)
Controlling the engine is the most processor-intensive job on your car, and the engine control unit (ECU) is the most powerful computer on most cars. The ECU uses closed-loop control, a control scheme that monitors outputs of a system to control the inputs to a system, managing the emissions and fuel economy of the engine (as well as a host of other parameters). Gathering data from dozens of different sensors, the ECU knows everything from the coolant temperature to the amount of oxygen in the exhaust. With this data, it performs millions of calculations each second, including looking up values in tables, calculating the results of long equations to decide on the best spark timing and determining how long the fuel injector is open. The ECU does all of this to ensure the lowest emissions and best mileage. See How Fuel Injection Systems Work for a lot more detail on what the ECU does.
A modern ECU might contain a 32-bit, 40-MHz processor. This may not sound fast compared to the 500- to 1,000-MHz processor you probably have in your PC, but remember that the processor in your car is running much more efficient code than the one in your PC. The code in an average ECU takes up less than 1 megabyte (MB) of memory. By comparison, you probably have at least 2 gigabytes (GB) of programs on your computer -- that's 2,000 times the amount in an ECU.