Yes, it will work as long as you are installing the edition you have the key for. For example, if you have the key for Windows 7 Home Premium it will work if the downloaded image is of Windows 7 Home Premium. Service Pack doesn’t matter.
Contrary to the accepted answer: maybe.
It all depends on the
ei.cfg file found within the Windows ISO which will state whether or not the image is treated as an OEM version or a full retail version.
If you try to use an OEM licence key with a retail version then it will install, but won’t register and activate – and vice versa.
However all is not lost, you can change an ISO between the two types by using the information posted at Reinstall Windows 7: OEM or Standard?