Yes, you can. The only problem is if you are running a lot of software that won't run on Lion or Mountain Lion. The upgrade goes well, it's just the third party apps that threw fits in my case.
After that experience I decided to create a thumb drive installer for Mavericks and did a clean install.