A gasoline engine intakes a mixture of gas and air compresses it and ignites the mixture with a spark. A diesel engine takes in just air, compresses it and then injects fuel into the compressed air. The heat of the compressed air lights the fuel spontaneously.
A gasoline engine compresses at a ratio of 8:1 to 12:1, while a diesel engine compresses at a ratio of 14:1 to as high as 25:1. The higher compression ratio of the diesel engine leads to better efficiency.
Gasoline engines generally use either carburetion, in which the air and fuel is mixed long before the air enters the cylinder, or port fuel injection, in which the fuel is injected just prior to the intake stroke (outside the cylinder). Diesel engines use direct fuel injection to the diesel fuel is injected directly into the cylinder.