** When it hits the spin cycle for either rinse or spin it doesn't work **
Does it drain?
Can you hear the motor running when it should be spinning?
What does the timer do at this time? Continue to move as if it was working properly or stay in one particular spot?
** [If] I lift the lid and close it then the cycle starts. **
You mean it then just performs the spin function right?
If your washer is a Whirlpool built 'direct drive' design (and just spinning is NOT occurring but it IS draining Ok and the timer IS advancing normally), it sounds like a common failure of the timer (see the following link).
** I've tried replacing the timer but to no avail. **
With a brand new one??
If so and your washer is a Whirlpool built 'direct drive' Kenmore model, there may be a problem in the transmission. Although if the timer is pausing the motor between drain and spin, that is all opening the lid would simulate so if it then spun I would think the transmission would have to be working properly. :/