You can also take the Long Island Railroad - take the AirTrain (which you'll need to take for either LIRR or the subway) to Jamaica station, then take the train to Penn Station (34th between 7th and 8th Ave). You'll be 8 blocks from 42nd Street, but they are short blocks, and it's a lot faster and more comfortable than the subway.
The AirTrain is $5, and LIRR is $5, so it's only $3 more than the subway. More info on LIRR and AirTrain
here and the train schedule
here.