Create a wifi hotspot like this:
sudo nmcli connection add con-name <NAME> type wifi ifname <INTERFACE> wifi.mode ap wifi.ssid <SSID> wifi-sec.key-mgmt wpa-psk wifi-sec.psk <PASSWORD> ipv4.method shared
That is a minimal configuration which should work on all Raspberry Pi devices from v3 upwards. Problem with this configuration is, that it only provides weak WPA encryption/security.
To remedy this you can switch on some additonal security features:
sudo nmcli connection modify <NAME> wifi-sec.proto rsn wifi-sec.pairwise ccmp wifi-sec.group ccmp
But this could result in clients not being able to connect to the Hotspot.
You can also use a more convenient configuration shortcut, which provides a Hotspot with these security features already enabled:
sudo nmcli device wifi hotspot con-name <NAME> ifname <INTERFACE> ssid <SSID> password <PASSWORD>
If you want to have the hotspot up and running after reboot, you need to modify the connection with these parameters:
sudo nmcli connection modify <name> connection.autoconnect yes connection.autoconnect-priority 100