President Obama addressed graduates of a historic African American high school in south Memphis during a commencement ceremony Monday, marking a milestone for 155 seniors and a success story for an impoverished and long-struggling urban school.

Obama told the packed Cook Convention Center, about a mile from where the Rev. Martin Luther King Jr. was shot in 1968, that the graduation of the Class of 2011 at Booker T. Washington High School was an “especially hopeful” occasion.

“Just a couple of years ago, this was a school where only about half the students made it to graduation,” he said. “Well, we are here today because every single one of you stood up and said, ‘Yes, we can. Yes, we can learn. Yes, we can succeed.’ ”

The Memphis school graduated the city’s first class of African American students 120 years ago and counts among its alumni the city’s first black mayor and a former executive director of the NAACP. Today it’s essentially still an all-black school in an impoverished neighborhood with high rates of violence and teen pregnancy. A public housing project near the school was demolished recently, and 20 percent of the students had to move, commuting on sometimes long bus routes.

But in recent years the school has increased its graduation rate from 63 percent in 2008 to 82 percent in 2010. Its performance on standardized math tests has increased and now exceeds state averages, and the number of students who go to college has also soared. Obama highlighted the introduction of new college-level courses and a robotics team.

“If success can happen here at Booker T. Washington, it can happen anywhere in Memphis. It can happen throughout Tennessee. And it can happen all across America,” Obama said at the convention center, just off the banks of the swelling Mississippi River.

The school’s success is what led to its marquee commencement speaker: Obama’s speech was the prize for winning a White House-sponsored Race to the Top Commencement Challenge.

The contest was inaugurated last year to promote the president’s goal of the United States having the world’s highest proportion of college graduates by 2020. The United States, once a leader in college attainment, now ranks below South Korea, Japan and several other countries in the rate of young adults earning college degrees.

Nearly 500 schools applied for the commencement prize by submitting essays and achievement statistics, as well as videos showcasing their school culture and track record of preparing graduates to go on to college or skilled jobs.

When White House officials called Principal Alisha Kiner to say her school had been selected as a finalist, according to the recorded phone conversation, she told them “I think I’m going to faint. I have to sit down.”

Kiner made several changes to reform the struggling school when she took over in 2005. She established gender-specific classes for ninth- and 10th-graders and nurtured a family environment with advisers keeping in close touch with students and urging them on to graduation.

Some of the graduates said the personal relationships are what have most improved the school. Many referred to Kiner as “Mama.”

“Miss Turner is like my auntie,” said senior Christopher Dean, referring to Assistant Principal Veda Turner. “There are good teachers, but when we come to school, it’s not just about education; it’s about how is your mama, how is your family doing.”

Obama made a surprise visit to the senior class before the ceremony. The stunned students rose to their feet cheering, and some wept. Obama thanked them for inspiring him and told them, “I could not be prouder of what you do.”

“But I’ve still got some big, big expectations for you, so don’t think just because you graduate from high school that that’s it,” he said. “You’ve got a lot more work to do.”