To create a custom hotkey on Spotify, you'll need to use a third-party program like AutoHotkey. Once you've downloaded and installed AutoHotkey, you can create a new script by right-clicking on the desktop and selecting New > AutoHotkey Script.
In the script, you'll need to define the hotkey and the action that should be taken when the hotkey is pressed. For example, to create a hotkey that pauses Spotify, you would add the following lines to the script:
#p::
Pause
To save the script, simply click File > Save As and give it a name with the .ahk extension. Once you have the script saved, you can double-click it to launch it. The hotkey will be active as long as the script is running.