If the answer itself is useful, and the link does not do anything to improve the answer (for example, relevant software tools, external pages for additional information, etc.), then I would say just edit to remove the link.
Then, keep an eye on the answer for a while, and if the edit gets rolled back or the link gets added back in, then you might consider flagging as spam.
You might also want to comment to points out to the user that including unrelated links in an answer is discouraged as it can be seen as spam, even if technically it isn't.
If the answer is not useful, I would suggest treating the answer in the same way as any other non-useful answer: vote down, flag or whatever is appropriate in the particular case.