iCloud comes with free 5GB space. If I enable iCloud to backup my iPhone app (10GB+), is the app size counted as part of the 5GB space? Or only the data of apps is counted?
Anything on your iPhone that Apple sells in its stores (that is, any music, apps, movies, books, etc. you've purchased and are still available) will be backed up and won't count towards the 5GB total.
That doesn't include, obviously, app data, your photos and videos, SMS and the like (from iCloud: Backup and restore overview):
There are some caveats to consider when using iCloud Backup, though:
I warmly recommend that you read Choosing an iOS backup method (Should I use iTunes or iCloud to back up my iOS device?) for more information on iTunes and iCloud backups and which may the right choice for you.
If the size of your backup exceeds the 5 GB free storage limit, an alternative to purchasing additional storage is to restrict which app data will be backed up. You can do that in Settings > iCloud > Storage & Backup > Manage Storage.