A heat engine in which fuel is burned in combustion chambers within the engine rather than in a separate furnace (as with the steam engine). The first working engine was the four-stroke Otto engine produced in 1876 by Nikolaus Otto (1832–91). In this type of engine a piston descends in a cylinder, drawing in a charge of fuel and air through an inlet valve; after reaching the bottom of its stroke the piston rises in the cylinder with the valves closed and compresses the charge; at or near the top of its stroke the charge is ignited by a spark and the resulting increase in pressure from the explosion forces the piston down again; on the subsequent upstroke the exhaust valve opens and the burnt gases are pushed out of the combustion chamber. The cycle is then repeated. Otto’s engine used gas as a fuel; however, the invention of the carburettor and the development of the oil industry at the end of the 19th century enabled the Otto engine to become the source of power for the emerging motor car. A variation of the Otto four-stroke engine is the two-stroke engine that has no complicated valve system, the explosive charge entering and leaving the cylinder through ports in the cylinder that are covered and uncovered by the moving piston.
An alternative to the Otto engine, especially for heavy vehicles where weight is not a problem, is the compression-ignition Diesel engine invented by Rudolf Diesel (1858–1913) in about 1896. In this type of engine there are no sparking plugs; instead air is compressed in the cylinder, causing its temperature to rise to about 550°C. Oil is then sprayed into the combustion chamber and ignites on contact with the hot air. While the spark-ignition petrol engine typically works on a compression ratio of 8 or 9 to 1, the Diesel engine has to have a compression ratio of between 15 and 25 to 1. This requires a much heavier, and therefore more expensive, engine. See also gas turbine.