No need for the ‘z’ :)
tar caf $archive $file... to create
tar xf $archive to extract
"x" will automatically recognize the compression format, and "ca" will automatically infer the desired compression format from the extension in $archive, e.g. tar caf backup.tar.xz /home/user
makes an xz-compressed tarball.