Javier Esposito is a homicide detective at the 12th precinct. He is partnered with Detective Kevin Ryan and is the consummate cop, always backing up Ryan and Detective Kate Beckett, whom he watches out for like an older brother.
Between him and Ryan, he is the more rational, often finding himself siding with Beckett in spirited but friendly debates over Castle's fantastic theories: in The Fast and the Furriest he and Beckett tried to disprove Castle's and Ryan's belief that their killer was Bigfoot.
Being part Hispanic, he speaks Spanish and sometimes translates for Beckett's team.
He is played by actor Jon Huertas
Jon Huertas envisions Esposito as growing up "in a neighborhood where maybe they didn't like the cops so much. But I think he was always a doer of good. He would step in and defend the little guy against the big guy, that sort of thing...he wants to make his parents proud, make his family proud, his friends proud of who he is now...He just always wanted to do good. Esposito has a bit of a hero complex, and I'd like to explore that a little bit...I think that Esposito would die for Beckett in a heartbeat. He'd protect her from anything"
In Under the Influence, Esposito reveals to a young boy who helps him solve a murder that when he was younger, his parents divorced and his Dad moved to Florida, and eventually lost touch with him. As his Mom worked two jobs, he fell into a life of crime and developed a record that includes assault and resisting arrest. Eventually, a teacher set him straight, just like a teacher got Jon Huertas focused on acting.
In Heartbreaker, we discover that Javi eats with his extended family every Thursday at 'family dinner night' at his mom's house. His favourite food is his mom's mofongo, which Ryan also enjoys.
Prior to working as a cop, he served in the military in the Special Forces as a sharpshooter/sniper, with some of his service done in Iraq. Upon returning to the U.S., he suffered from post-traumatic stress disorder (PTSD) and, as a result, was able to help Beckett when she had her own bout with PTSD after being shot. He is frequently seen using a long rifle as his weapon, instead of his police-issue hand gun.
Before working at the 12th precinct with Beckett, he worked as a beat cop at the 54th precinct. His former partner, Ike Thornton, faked his death to discover the identity of the dirty cop who framed him as being connected to a crime boss. After Thornton's "death," he transferred from the 54th precinct to the 12th three years prior to season 2 of Castle.
He once served on a department task force on gangs.
After Beckett becomes captain of the 12th, both Esposito and Ryan take their sergeant's exams. Esposito passes but Ryan does not, which causes tension between them. The relationship deteriorates even further when Ryan accidentally shoots Esposito in the backside during a pursuit , and it is suggested they both find new partners. However, after Ryan takes a bullet for Esposito during an arrest, they reconcile and are expected to stay together for some time while Esposito waits for a sergeant's slot to become available. 
He played varsity sports in high school, ran triathlons, and was featured in the 2007 NYPD calendar.
Cars also interest him. In Lucky Stiff, he tells Castle that if he ever wins the lottery, he plans to buy a Ferrari. He frequently makes Castle promise to lend him his Ferrari in exchange for his doing him favors and in Scared to Death, he wonders if he will inherit the car if Castle dies.
He periodically flirts with Beckett's best friend, Medical Examiner Lanie Parish. He finally succeeds in winning her over in Nikki Heat, but they keep their relationship private from their co-workers, not knowing that they have all figured it out anyway. In Lucky Stiff, Ryan tells Esposito that he, Beckett, and Castle know about the relationship. They date until Demons in season 4, when they put their relationship on hiatus after the question of marriage comes up during a double date with Ryan and his fiancee Jenny. Afterward, they continue to bicker, prompting Beckett to observe, ironically, that they want to be together, but neither knows how to or is willing to make the first move.
In an interview with Bollyspice.com, given while he was shooting season 5, Jon Huertas said the following about Lanie and Esposito: "One thing that they had cut out of the wedding episode, Ryan and Jenny’s wedding, it didn’t make it in, but she called it off with me because she didn’t believe in marriage...You know, she wasn’t into the marriage thing. I think Esposito was like, ‘what do you mean? We could get married one day’. She didn’t want to move that fast or even think about that. So I think Espo was a little hurt by it. Or not hurt, but surprised by it. She was like ‘hey, I like you, I want to do this, but we gotta do it on these terms’. Like an occasional booty call."
In Kill Switch, Esposito strikes up a connection with an attractive transit cop, Marisa Aragon, while they are both being hostages on a subway car by a terrorist. But at the moment when Esposito takes down the terrorist, Aragon notices that he mutters Lanie's name before making his move. Despite their mutual chemistry, she tells him at the end of the episode: 'Who you think of in that moment? It has weight. Don’t trade what’s real for something that isn’t.'
In Heartbreaker, it emerges that Esposito was once engaged to a woman, Sonia Ruiz, during his time at the 54th Precinct, but that she had been involved in a gold heist and that Javi had been forced to arrest her. Nine years later, he falls victim to an elaborate ruse concocted by Sonia to have herself released on furlough and find her share of the gold. He is forced to arrest her again, after a dangerous standoff with an accomplice in which Sonia intervenes to stop him being shot.
He once admitted to patronizing a falafel stand for two months after developing a crush on the female salesgirl.
- Heroes and Villains, Episode 4.2
- Punked, Episode 3.4
- Stana Katic fan newsletter, September, 2010
- Kick the Ballistics, Episode 4.4
- Killshot, Episode 4.9
- Den of Thieves, Episode 2.21
- Almost Famous, Episode 3.7
- The Nose, Episode 8.5
- The Last Seduction, Episode 8.7
- Almost Famous, Episode 8.5
- Cuffed, Episode 4.10
- "I would love to do a Bollywood movie because I would love to challenge myself" - Jon Huertas, by Reema Patel, Bollyspice.com, posted October 16, 2012
- Food To Die For, Episode 2.22