Trafalgar Law used his powerful Devil Fruit ability called 'Ope Ope no Mi.' He utilized his 'Room' technique to manipulate objects and create a barrier, effectively nullifying Doflamingo's strings and ultimately defeating him.