I've found out how to do this with other attributes.
For example a custom 'location' attribute:
$product = $this->objectManager->get('Magento\Catalog\Model\Product')- >load($post['id']);
$productResource = $this->objectManager->create('\Magento\Catalog\Model\ResourceModel\Product');
$product->setLocation('test');
$productResource->saveAttribute($product, 'location');
This saves the 'location' attribute value for my product.
But how would you do this for the stock attribute 'qty'?