In the context of an internal combustion engine, the term stroke has the following related meanings:
Commonly used engine phases or strokes (i.e. those used in a four-stroke engine) are described below. Other types of engines can have very different phases.
The induction stroke is the first phase in a four-stroke (e.g. Otto cycle or Diesel cycle) engine. It involves the downward movement of the piston, creating a partial vacuum that draws a air-fuel mixture (or air alone, in the case of a direct injection engine) into the combustion chamber. The mixture enters the cylinder through an intake valve at the top of the cylinder.
See also: Compression ratio
The compression stroke is the second of the four stages in a four-stroke engine.
In this stage, the air-fuel mixture (or air alone, in the case of a direct injection engine) is compressed to the top of the cylinder by the piston. This is the result of the piston moving upwards, reducing the volume of the chamber. Towards the end of this phase, the mixture is ignited, by a spark plug for petrol engines or by self-ignition for diesel engines.
The combustion stroke is the third phase, where the ignited air-fuel mixture expands and pushes the piston downwards. The force created by this expansion is what creates an engine's power.
The exhaust stroke is the final phase in a four stroke engine. In this phase, the piston moves upwards, squeezing out the gasses that were created during the combustion stroke. The gasses exit the cylinder through an exhaust valve at the top of the cylinder. At the end of this phase, the exhaust valve closes and the intake valve opens, which then closes to allow a fresh air-fuel mixture into the cylinder so the process can repeat itself.
The thermodynamic cycle used by a piston engine is often described by the number of strokes to complete a cycle. The most common designs for engines are two-stroke and four-stroke. Less common designs include five-stroke engines, six-stroke engines and two-and-four stroke engines.
Two-stroke engines complete a power cycle every two strokes, which means a power cycle is completed with every crankshaft revolution. Two-stroke engines are commonly used in (typically large) marine engines, outdoor power tools (e.g. lawnmowers and chainsaws) and motorcycles. 
Four-stroke engines complete a power cycle every four strokes, which means a power cycle is completed every two crankshaft revolutions. Most automotive engines are of a four-stroke design.
The stroke length is how far the piston travels in the cylinder, which is determined by the cranks on the crankshaft.
Engine displacement is calculated by multiplying the cross-section area of the cylinder (determined by the bore) by the stroke length. This number is multiplied by the number of cylinders in the engine, to determine the total displacement.
The term stroke can also apply to movement of the piston in a locomotive cylinder.