Oil gains after US-China trade deal, fall in inventories