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.
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
Log-in in to your iTunes account on your new Mac and then sync as normal. You'll be asked if you want to copy stuff from your iPhone to Mac (which you probably want to do) and then you should be able to continue as normal. Remember to authorize your new Mac with your iTunes account as well.
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
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: