If the requirement is to take online backup(hot) backup that can be used to do point in time recovery, you can rely on low-level API functionality mentioned earlier by Paul. If you to be care free about not missing any specific mount point other than default mount point, you can use pg_basebackup for online backup.
Pg_basebackup will take care of backing up all database files including custom tablespace and has the option to compress the backup.You can refer to below link for more information.