Google has long named links as one of the signals it uses to understand how useful a page is, and it also fights link spam. Its spam policies describe buying or selling links for ranking, excessive link exchanges and automated link creation as violations. Its systems can neutralize such links, and a clear scheme can result in a manual action against the site.
If unwanted links point to your site, you can ask Google to ignore them with the disavow tool in Search Console. Google says most sites don’t need it, and it should be used carefully, after an audit and only when the links really are a problem.
From this follow the rules of safe link building. Links should be relevant and sit in a useful context. Anchors should be varied, dominated by the brand name, the site address and neutral phrases. Paid or sponsored placements should be marked with the right link attributes, such as rel="sponsored". The profile should grow gradually and in proportion to the company’s visibility. And every link should be one a real person would be glad to click.
For a deeper look at how links affect ranking, read our article on what link building is.