Yes you may, but do it correctly or the government will be showing up in a year wanting back taxes and penalties. I have seen people really get killed on this. There are companies that specialize on 1031 exchanges, they charge a lot, but it is way less than getting it wrong.
It really is not that hard though. You can do it yourself, just read up on and make sure you do it correctly. There are time periods you must meet, paperwork to file and ways to handle the funds.