If all you are wanting is M3 (on) and M5 off, this is provided for in Mach 3. There are four outputs which are fairly general to most CNC and this is M3 M4 and the two coolant switches. I am away from my machine at the moment so I can't remember them and I am using someone elses lap top - but they are something like M6 and M7or M7 and M8.
Whatever - if you look at Conf1g/Ports and Pins/Spindles drive, you can allocate these functions to outputs (usually 1,2,3 and 4)
On Config/Port and Pins/Outputs you can allocate these outputs to pins. There are five available. If you are thinking of providing a variable speed signal as well that is your fifth output (using the standard LPT1 port)
I wired a small vero board circuit where the four outputs drive four relays, using a Darlington array chip. The Darlington array is an eight bit chip (on 18 pins) The inputs are 5 v positive, the output is 0v at 1/2 amp per pin. A 0v (common) and +voltage (voltage of what you are driving) make up the other two pins. Outputs can be wired together to increase the current - more than adequate to drive relays (diodes are included in the chip).
I only use M3 and M4 at the moment, the coolant will have to wait and so I have two outputs spare that will still give output signals if I want to alllocate them.
I am sure you will be able to drive a relay with the capacity for your spindle drive if needed.