Is it actually legal to use an offshore company?

Yes. Certainly, it should be used with care and some good advice. Many high-tax countries have introduced some countermeasures in their tax regulations against known offshore finance centres. In particular, some high-tax governments have introduced a sort of discriminating witholding tax on direct payments from domestic businesses out to foreign companies, which are situated in certain listed offshore jurisdictions. Therefore, it is a good idea to check if Your country has such a "blacklist" or any discriminating regulations targeting transactions with offshore corporations. Your domestic tax lawyer or accountant should be able to clarify this question. All-in-all, offshore company is just the same as Your domestic business entity, only the offshore corporation is not burdened by excessive tax, is faster to incorporate and easier to manage. In itself, it's completely legal to have and use.