Jennifer Lopez stars as Detective Harlee Santos in “Shades of Blue,” which premieres Thursday. (Peter Kramer/NBC)

NBC’s solid and sometimes ambitious dirty-cop drama “Shades of Blue” (premiering Thursday) finds Jennifer Lopez taking yet another lap around the block. It’s tempting to laugh off the pop superstar’s attempt at glamming down (a rather sexy definition of “glammed down”) and star in a “serious” show, but the results are not entirely unimpressive. In fact, “Shades of Blue” recalls that talented actress many of us only first noticed in the 1998 film adaptation of Elmore Leonard’s “Out of Sight.”

In this 13-episode series created and written by Adi Hasak, Lopez stars as Harlee Santos, a New York police detective up to her complicit neck in corruption, serving at the whim of her mentor, Lt. Matt Wozniak, played by Ray Liotta, an actor who’s also been around the block a few times and is pretty much always trying to live up or down to the way we remember him in Martin Scorsese’s “GoodFellas,” 25-plus years ago.

Under Wozniak’s command, Harlee and a handful of other detectives advance their interpretation of justice (and line their pockets) through a variety of off-the-book means, convinced by their lieutenant that they’re on the side of angels. In the opening moments, we watch as Harlee plants evidence to cover up the fact that her rookie partner (Dayo Okeniyi) has just shot and killed an unarmed man suspected of running drugs.

At home, Harlee is a single mom to a teenage daughter, Cristina (Sarah Jeffery), who attends Juilliard (she’s an ace cellist), and that sort of thing doesn’t come cheap. Harlee is under Wozniak’s thumb, thanks to a devil’s pact she agreed to when Wozniak helped frame her abusive ex-boyfriend (Cristina’s father) for murder and put him behind bars.

Viewers aren’t given much time to figure out whether Harlee is a good person. A creepy FBI agent, Robert Stahl (Warren Kole), nabs Harlee in a bribery sting and gives her an ultimatum: Go to prison or risk her life by turning informant on Wozniak’s whole operation.

Lopez alongside Ray Liotta as Lt. Bill Wozniak (Peter Kramer/NBC)

Hey, now — let’s not all reach for the cliche buzzer at once.

Of course you’ve seen a lot of plots such as this one. “Shades of Blue” certainly isn’t shy about hauling out some of the tropiest tropes about cops who find themselves wearing a wire. Still, there’s something compelling and worth watching here — mainly Lopez’s enthusiastic and determined performance. Liotta also has a lot left to give, even if one would suspect that he long ago tired of playing the complicated baddie.

And while every episode verges on the preposterous, “Shades of Blue” sticks to a tight and active sequence of events, strewn here and there with a few tangents that seem to serve no other purpose than to extend the series. (I think six episodes — firmly and decisively concluded — might have been just the thing. As it is, the network sent eight episodes to critics, which start to get flabby and repetitive as the story heads for a showdown between Harlee and Wozniak.)

We all rag plenty on NBC, but “Shades of Blue” is yet another occasion where you can witness the network attempting an honest upgrade from its usual fare. (Heck, I give “Shades of Blue” points simply for not having the word “Chicago” in its title.) Recent other examples were last spring’s homeland-insecurity thriller “American Odyssey,” which I liked fine, but seemingly gave the rest of you a case of the yawns, and the imaginative 1960s cop drama “Aquarius,” which, trust me, was a much better use of David Duchovny’s time than this “X-Files” reboot you’re all so hopped-up about.

“Shades of Blue” is far from perfect, it’s true. On the one hand, it imbues Lopez’s character, a woman in her mid-to-late 40s, with the sort of sexual confidence and no-strings-attached playbook we respect in macho male characters (she wastes no time seducing a distractingly handsome assistant DA played by Gino Anthony Pesi), but the show squanders such contextualizing when it strains to think of new ways to exploit and sexualize Lopez’s screen presence. Stahl, the FBI agent, is clearly obsessed with Harlee, and a scene where he manhandles her and whispers threats into her ear feels like a regressive habit.

But the real news here is that “Shades of Blue” is good enough to get a viewer thinking about what he or she is watching and asking questions like that — what works, what doesn’t and, more importantly, what happens next? These are usually the signs of decent television.

Shades of Blue (one hour) premieres Thursday at 10 p.m. on NBC.

Dayo Okeniyi plays Michael Loman, the rookie partner or Lopez’s character. (Peter Kramer/NBC)