If you doing exercises, a metronome might be a better choice, but if you're doing a lead or melody or playing a whole song, then absolutely. In my formative years, I found that playing along to albums and cassettes (yeah, this was before CDs and the internet) got me ready for playing in a band.