I have brought a new mac and would like to sync my iPhone content with the new mac (i.e. contact, calendar, apps and etc..) As the the first sync will erase all contents from my iPhone, is there any way to avoid it. If the iPhone backup has been performed on the old PC, can I restore all the content from the backup if the content was erased during sync with the new mac. Please advise.
I logged in, authorized and used "Transfer Purchases from iPhone" as described in @appleluntanyi's answer and the linked article.
When syncing apps, I got the dialog
Are you sure you want to sync apps? All existing apps and their data on the iPhone "iPhone" will be replaced with apps from this iTunes library.
Cancel / Sync Apps
When I synced anyway, it did in fact keep the app data, but it messed up the icon order and grouping.
So I would recommend syncing the iPhone to your old computer just in case, taking screenshots of your home screens if you want to remember how they were arranged, doing the login/auth/transfer as described in the article, and then syncing despite that incorrect dialog.
You can e.g. transfer the screenshots to the computer through Preview.app:
File > Import from iPhone….