Luffy seems to have developed a positive relationship with Trafalgar Law and his crew, as they braved the Whitebeard War and the attacks of the Marine admirals just to save him.
Although seeing that they are both Supernovas, and therefore rivals, there may be some ulterior motive behind Law’s decision to save Luffy. While on the other hand, Law has been shown to respect Luffy, and could quite simply have come to save him because of that respect. When Luffy met Law on Punk Hazard, Luffy was happy to see him again, not knowing Law’s intentions. Luffy stated, with a happy smile on his face, that he and Law will be enemies if he’s going after the One Piece too, but he is grateful nonetheless.
Luffy appears to trust Law to go along with his plan of action. When Law was shot by Doflamingo, Luffy showed a lot of concern for his ally. After that, when Law was kidnapped by the Shichibukai, Luffy stated his desire to rescue him.
On Punk Hazard, Luffy and Law formed an alliance with the sole purpose of overthrowing Kaido of the Yonko, making their crews allies in a relationship (which Luffy perceives to be as practically a friendship, but Law sees as more of a professional agreement).
Law deeply respects Luffy for his role in the downfall of Doflamingo, as shown when Bepo, upon reuniting with his captain happily commented that Law had brought down Doflamingo, Law stated ‘that was Straw Hat’s doing.’ When Luffy agrees to help the Mink tribe and the Kozuki clan take down Kaido, Law feels slighted at not being asked for input, questioning Luffy about his faith in him.