Detailed answer
Use a link to navigate to a resource and a button to perform an action.
Native differences preserve expectations such as opening destinations in new tabs and activating controls with the keyboard. Styling does not determine purpose. A navigation link can look like a button while remaining an appropriate link.
Example
<a href="/examples/">Browse examples</a>
<button type="button">Run current code</button>
Understanding the behavior
Links navigate to destinations; buttons perform actions such as submitting, opening or toggling. Appearance can be shared through CSS, but the underlying element should still match the behavior. A fake href used only to trigger a script can produce surprising navigation.
Practical implementation notes
Test copy-link, open-in-new-tab and keyboard behavior. If those navigation actions make no sense for the control, a button is often the more suitable starting point.
How to check it
Try keyboard operation and the link context menu on each appropriate native element.
Expected result
The action is a button and the destination is a navigable link.
Watch out: Avoid javascript URLs as substitutes for ordinary action controls.
Read the reference ↗