You can try to "inherit" your old backup to be able to browse it on the new mac and to restore from it using Time Machine. When you "inherit" the backup, you are able to restore single files or the iPhoto Library. See Pondini's FAQ:
B6. "Reconnecting" to your backups: http://pondini.org/TM/B6.html
B5. Would you like to inherit (or re-use) the backup . . . ?: http://pondini.org/TM/B5.html
The easiest way to be able to use the Time Machine backup an old Mac however, is to set a new mac up with "Setup Assistant", the first moment, when you set up a new Mac and are asked how you want to transfer data.If you use Setup Assistant to migrate the settings of your Mac from the old mac and your home folder. You inherit the Time Machine backup, and your user account will be the same user as on your old mac and you avoid all kind of permission problems. Transferring later complicates things, because you already have created a new and different user account.
I've got an old iMac that's about to crash and is extremely slow.
What makes you think, the old mac is about to crash? If it is only slowness and general unresponsiveness, check, how full your disk is. Sometimes a Mac just looks like having hardware trouble, when you allow the free disk space to drop below a critical minimum of at least 10GB of free disk space.