There are two ways to calculate the Earth’s mass. It can be either by Newton's second law or by Newton's gravity equation. In both, the answer is exactly the same.