Yes. MBs are standardized as to size. Are you replacing anything else along with the MB?
Keep in mind, that a totally different MB than the one you have now will require a fresh install of Windows*. And when you go to "activate" it through MS, it may ask you some questions when it sees a new board. The OEM copy of Windows you got with the HP is only licensed to one machine, and MS ties the license to the MB.
*After installing the new MB, If you can actually manage to boot to Windows from your old installation, you may be able to get by w/o a fresh install. Windows will try to load some generic drivers for the new board. You can then run a pgm like CCleaner to get rid of all the junk files and Registry errors that result...