I can understand that the approach of the topic provided by this answer, through the projection system, can help you obtain acceptable inaccuracies.
But let me dig a little deeper on the subject.
Beyond that we all know that a curved surface can not be represented on a plane without producing modifications, it is not necessary to measure areas and distances on the plane: we can measure curved areas and distances. And that is precisely what should be done in these cases.
Leaving the theme of how Google Earth manages to adjust and represent their images on our flat screen, or what are the projection systems that each country establishes in order to represent their cartographic maps on paper (or digital cartesian coordinates), trying to produce as little distortion as possible, we will think that given two longitude-latitude coordinates on an ellipsoidal body, it is perfectly possible to know the distance that separates them, measured on the curved surface of the body. And that's what Google Earth does when measuring distances, and also what QGIS can do with its area
and length
functions.
Google Earth does it without asking us or allowing us to answer what ellipsoid is being measured. Simply measured on the ellipsoid defined by the WGS 84 system. Google Earth Pro also measures on the EGM96 geoid or on the SRTM model when the Terrain layer is active.
QGIS can measure on any system instead. But so much flexibility can play against us if we do not know what it's measuring.
First and foremost, let it know if we want measuring on a plane or ellipsoidal system. In the General Properties of the project we can specify that the measurements are made on an ellipsoid or that they are planimetric.
If we choose None/Planimetric, the length
and area
functions will perform their measurements in the projection system of the layer in which the geometries measured are located.
Instead, we can choose an Ellipsoid on which to measure among the many available, or even set the parameters for a custom one. In this case, length
and area
functions will measure ellipsoidal lengths and areas in the QGIS expressions (except labeling).
Therefore, my answer is: Choose the WGS 84 ellipsoid in the General Properties of your project in QGIS, and in Google Earth you will get values as identical as you can point to the correct line endpoints with the mouse.