Hanukkah celebrates the miracle that oil thought to be enough for only one day burned instead for eight. So the Jewish festival of lights is also, in a way, a celebration of surprise.

A temple in Queens got a small dose of surprise on Sunday — the final night of Hanukkah — when Representative-elect Alexandria Ocasio-Cortez, the New York Democrat with a knack for dramatic flourish, told those gathered to light the menorah that her ancestors were Jewish.

‘‘One of the things that we discovered about ourselves is that a very, very long time ago, generations and generations ago, my family consisted of Sephardic Jews,’’ Ocasio-Cortez said. These are Jews who settled in the Middle East, North Africa and southern Europe after the Jewish diaspora. They were expelled from Spain in 1492.

The announcement drew murmurs at the Jackson Heights Jewish Center. Someone in the audience at the event, organized by Jews For Racial and Economic Justice, made a remark, which can’t be heard in a video of the congresswoman-elect’s brief speech, but which seemed to embrace her as a fellow Jew. She replied, ‘‘He’s like, ‘I told you! I knew it! I sensed it!’’’

She laughed, using the occasion to connect with soon-to-be constituents, and drawing a broader lesson about religious freedom and shared values. Ocasio-Cortez, who has identified as Catholic, hardly claimed to be a practicing Jew. Her understanding of her ancestry came from ‘‘doing a lot of family trees in the last couple of years,’’ she said.

Ocasio-Cortez explained that she was descended from Jews who fled Spain during the Spanish Inquisition, when ‘‘many people were forced to convert on the exterior to Catholicism but on the interior continued to practice their faith.’’

‘‘And a strong group of people, strong-willed, that were determined to continue living life as they wanted to live it decided to get on a boat and leave Spain,’’ she continued. ‘‘Some of those people landed in Puerto Rico,’’ where her mother was born. The 29-year-old’s father is also of Puerto Rican descent, though he was born in the Bronx.

The discussion of distant Jewish heritage is not an uncommon one. This summer, House Speaker Paul Ryan of Wisconsin, a practicing Catholic, found out that he was 3 percent Ashkenazi Jewish, based on findings from PBS’s ‘‘Finding Your Roots with Henry Louis Gates Jr.’’

The discoveries come amid a vexed moment for claims to ethnic and religious ancestry. As she nears a decision about whether to vie for the presidency, Senator Elizabeth Warren of Massachusetts has been dogged by concerns that she mishandled the controversy over her Native American heritage by releasing DNA results in October aimed at fending off President Trump’s taunts of ‘‘Pocahontas.’’ But tribal groups reject the idea that Native American identity is purely a matter of blood ties.

While Ocasio-Cortez’s announcement was hardly comparable, it could still raise notable questions about her position on Israel and other topics dear to some American Jews, including those in her district, which includes sections of the Bronx and Queens.

The liberal firebrand is part of an incoming class of Democratic lawmakers who appear willing to split with the party’s top brass in criticizing the Israeli government. In May, before she bested long-serving incumbent Rep. Joseph Crowley, Ocasio-Cortez condemned the killing of Palestinians on the Gaza border as a ‘‘massacre.’’ In July, she criticized the ‘‘occupation of Palestine’’ but also said she was ‘‘not the expert’’ on the issue - in remarks that drew scorn from conservatives.

At the same time, Ocasio-Cortez has stopped short of the position taken by some of her soon-to-be Democratic colleagues, such as incoming Representatives Rashida Tlaib of Michigan and Ilhan Omar of Minnesota. Both have endorsed the movement known as BDS, for boycott, divestment and sanctions. It seeks the end of Israeli occupation of ‘‘all Arab lands,’’ the full equality of Arab-Palestinian citizens of Israel and ‘‘the rights of Palestinian refugees to return to their homes and properties as stipulated in UN Resolution 194.’’ Ocasio-Cortez has not taken a stance on the movement, which has roiled college campuses and spurred searching debates about the distinction between anti-Zionism and anti-Semitism.

Ocasio-Cortez has not shied away from drawing lessons from Jewish history. Last month, as searing images of Central American women and children drew the country’s attention to the southern border, she suggested on Twitter that efforts by Jewish families to flee Nazi Germany - blocked, in many cases, by restrictive immigration laws - should serve as a warning for those seeking to bar migrants from claiming asylum. Sen. Lindsey Graham, R-S.C., said the comparison was improper, but the Democrat stood her ground, finding support among progressive Jewish groups.

During the Hanukkah celebration on Sunday, Ocasio-Cortez didn’t dwell on her own sense of Jewish identity but rather used her family’s history to make a case for cultural diversity.

She said the multiethnic character of Puerto Rico — black, indigenous, Spanish, European - provided a unique way of understanding religious complexity, ‘‘to think about how the culture in Puerto Rico was that people would open their closet and there would be a small menorah inside.’’

The amalgamation of different cultures, she said, creates something ‘‘entirely distinct.’’

‘‘I think what it goes to show is that so many of our destinies are tied beyond our understanding, beyond even what we know,’’ she concluded.