The diverse district, which is heavily Democratic, includes Orthodox Jewish neighborhoods as well as Italian, Chinese and Russian enclaves.
"I look forward to working with the entire district," Greenfield said in a statement early Wednesday.
Greenfield, director of the education advocacy group TEACH NYS, had won a number of high-profile endorsements, including that of Mayor Michael Bloomberg, who campaigned with him last week.
Greenfield served as deputy director of finance for the presidential campaign run by Lieberman, I-Conn., and as chief of staff to state Assemblyman Dov Hikind.
With all precincts reporting Tuesday night, Greenfield had 58 percent of the vote, followed by Joe Lazar, with 40 percent. Republican Kenneth Rice, an attorney for the New York Police Department, had about 3 percent.
Lazar, a son of Holocaust survivors who has worked for the city Department of Buildings and state Office of Mental Health, had received the majority of endorsements from local politicians.
Greenfield will serve for the rest of the year. The seat is up for election again in November.