There are three ways of doing that:
The most convenient way of getting to Moscow from St. Petersburg is by train. From City Centre to City Centre. Two options are available: overnight (8 hours, saving the cost of one night's accommodation) and high speed "Sapsan" train (just a little under 4 hours).
If you're planning to buy your train tickets online - use only the genuine Russian Railway website!
Click here in order to see the trains, time table and buy a ticket to Moscow or St. Petersburg