Calculate distance travelled by vehicle using "knots" of NMEA data
Calculating distance from speed

As Peter Bennett has already written in his answer, you get the current speed in nautical miles from a GPS dataset. 
Multiplied by the time to the next GPS dataset, you get the distance traveled between the reception of the two datasets.

But: If you accelerate, the real speed increases, while your device thinks it's constant. So, the calculated distance is too low. The same applies when braking (calculated distance too high). A simple solution: Don't use the speed from the dataset, but the average speed between two datasets. If the acceleration is constant, the resulting distance is absolutely correct. If the acceleration is not constant, the result is still by far more precise.

Another BUT: What, if the GPS signal is lost for a longer period, like in a long tunnel? Let's say, the signal is gone for 6minutes. The last dataset states a speed of 50kt, the next of 10kt. How long is the distance?
If there's a traffic jam in the tunnel and the driver had to brake down to 10kt right after loosing the GPS signal, the length is 10kt*0.1h=1nm. If he has to brake right before the next GPS signal, the length is 50kt*0.1h=5nm. Using average speed results in 3nm. What's true?

Calculating distance from coordinates

To solve this problems, it's best to not rely on speed at distinct times, but to calculate the distance from the coordinates. This still has some disadvantages, as the distance will be a bit too low for sharp curves (or tunnels with curves), but it's still better than the speed-approach.

The distance of a position to the equator is

$$y=H \cdot\langle lat\rangle$$

and the distance to the prime meridian is

$$x=H\cdot\langle lon\rangle\cdot \cos\langle lat\rangle$$

The angles are given in radian, not degree:  \$\alpha[rad]=\frac{\pi}{180°}\cdot\alpha[°]\$

These formulas contain the distance to the center of the earth, which is
$$H=R_{earth}+\langle altitude \ by \ GPS \rangle$$

The distance between two coordinates can then be calculated by

$$d=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2+(H_2-H_1)^2}$$

About \$R_{earth}\$:
As first approximation, the earth is a sphere with an average radius of 6371km, but it is more an ellipsoid with a 21km larger radius at the equator than at the poles. As result, distances between two coordinates near the equator are about 0.5% larger than at the poles.
Mainly for correct altitudes, GPS usually uses a model of the earth called WGS84, which describes its ellipsoidal shape. The radius of the earth at a given latitude then is:

$$R_{earth}=\sqrt{(6356.7523km\cdot\sin\langle lat\rangle)^2+(6378.137km\cdot\cos\langle lat\rangle)^2}$$ 



Finally, this formula is only valid if the calculated distance is small compared to the size of the earth, so spherical effects can be neglected. (The shortest route from San Francisco, California to Rome, Italy is via Canada, Hudson bay,  Greenland, UK, while my solution is US east coast, Portugal, Spain).  If you are interested in calculating large distances, see Wikipedia about great-circle distances.
But for your application, this solution is fine