You can set the spreading factor, to 12, for the next packet transmission with:
Note that the LoRaWAN may attempt to adjust the spreading factor automatically (hence the reference to 'next packet' above). Also certain regions such as the US902 do not support SF12.
You should also keep in mind that increasing the spreading factor greatly increases the time on air. Transmitting at SF12 takes over 3x longer than transmitting at SF10.