(Sorry in advance for this long, rambling response) This applies to the US and forgive me if you have already done some of this. The first step is to get your corporation set up (use an online service or an accountant). It's a bit of paperwork but you can do it for around $400. Once you do that you can open a corporate bank account. At that point you bill your clients as a corporation and provide them with your corporate tax ID instead of your personal SS. The money goes into your business account. Then to pay yourself, the next step is to setup payroll (easiest way is to use an online service like quicken payroll) which will run you about $50/month but will handle all of your withholding and tax filing requirements.
It's somewhat of a pain getting this all going but once you do, you are operating as a corporation. Corporations do not pay income tax as such - they do have some filing fee type of taxes, but basically the taxes you pay come out of your payroll. So you do not pay tax on income that your company earns until you withdraw it from the company account via payroll. However, you can spend directly from the corporate account on anything that is reasonably considered a business expense. Computers and equipment, of course, can be purchased. Your company can pay the phone bills, internet connection, travel expenses, business lunches, etc. You can also charge your company rent as well if you are working out of your home.
What happens is that you wind up paying yourself a meager salary on which you pay normal tax just like everybody else. So for instance, your company earns $80. You pay yourself a salary of $15k and the remaining $65k money is spent on operating expenses and is a tax write-off. You only pay tax on that $15k. You're likely to even get a small tax refund check instead of a huge bill from the IRS. In some extreme cases you might pay yourself even less, or even come in at a loss and pay no income tax. There is nothing illegal about this as long as your write-offs can be legitimately considered a business expense.
This is also great because with payroll setup you are in a position to pay employees and sub-contractors via payroll as well and eventually grow your company with the proper financial system in place.
I would highly recommend having an accountant set this up for you and file your taxes though because it is a ton of work and requires understanding the ever-changing tax laws.