A diesel engine does not need spark plugs because the compressed air ignites on its own. This is different than gasoline engines, which operate at lower temperatures. Because of this, they need spark plugs to cause the ignition of the fueland air.
The temperature is higher in a diesel engine because of the higher compression ratio of air. In a gasoline engine, the fuel and air are mixed and then compressed at a lower ratio. The spark plug ignites this mixture.
Only the air is compressed in a diesel engine, which means the compression ratio can be higher. Fuel is then injected into this compressed air. This fuel is less refined than standard gasoline so it ignites easier. This combined with the higher temperatures brought on by the increased compression ratio causes a spontaneous ignition.
This process is called compression ignition. It happens in gasoline engines as well, but this is usually an indicator of a problem. When it happens in a gasoline engine, it is referred to as the engine knocking. Compression ignitionis the basis of how a diesel engine works, and it also means that, in general,diesel engines are more efficient than gasoline engines.